Created
July 21, 2010 14:08
-
-
Save jweslley/484539 to your computer and use it in GitHub Desktop.
Rails: loading seeds from 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
require 'csv' | |
CSV.foreach('path/to/seed.csv', headers: true, col_sep: ';') 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