Created
January 18, 2019 14:01
-
-
Save DimaSamodurov/14c39d05ec09f72c31f4f65ec613abcb to your computer and use it in GitHub Desktop.
Quick export ActiveRecord to CSV.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSV.open("tmp/records.csv", "wb") do |csv| | |
csv << ConnectRequest.attribute_names | |
ConnectRequest.where('created_at > ?', 2.day.ago).each do |record| | |
csv << record.attributes.values | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment