Skip to content

Instantly share code, notes, and snippets.

@kusakusakusa
Created November 9, 2015 04:00
Show Gist options
  • Save kusakusakusa/8e2d53d2c65ea7288d83 to your computer and use it in GitHub Desktop.
Save kusakusakusa/8e2d53d2c65ea7288d83 to your computer and use it in GitHub Desktop.
csv
require 'csv'
csv_text = File.read('...')
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
Model.create!(row.to_hash)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment