Skip to content

Instantly share code, notes, and snippets.

@DimaSamodurov
Created January 18, 2019 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DimaSamodurov/14c39d05ec09f72c31f4f65ec613abcb to your computer and use it in GitHub Desktop.
Save DimaSamodurov/14c39d05ec09f72c31f4f65ec613abcb to your computer and use it in GitHub Desktop.
Quick export ActiveRecord to CSV.
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