Skip to content

Instantly share code, notes, and snippets.

@westonwatson
Last active December 19, 2015 13:58
Show Gist options
  • Select an option

  • Save westonwatson/5965593 to your computer and use it in GitHub Desktop.

Select an option

Save westonwatson/5965593 to your computer and use it in GitHub Desktop.
import using FasterCSV
namespace :db do
desc "load user data from csv"
task :load_csv_data => :environment do
require 'fastercsv'
FasterCSV.foreach("data.csv") do |row|
User.create(
:user_name => row[0],
:email => row[1],
:password => row[2]
)
end
end
end
@westonwatson

Copy link
Copy Markdown
Author

out of date, i believe that FasterCSV was implented as the standard CSV lib now. so it's just CSV, not FastCSV anymore...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment