Skip to content

Instantly share code, notes, and snippets.

@lenagroeger
Created March 14, 2013 18:04
Show Gist options
  • Save lenagroeger/5163664 to your computer and use it in GitHub Desktop.
Save lenagroeger/5163664 to your computer and use it in GitHub Desktop.
task :import => :environment do
Member.delete_all
f = FasterCSV.open("#{Rails.root.to_s}/db/initial/membersgrades.csv", :headers => true)
f.each do |row|
m = Member.new
m.grade = row["grade"]
m.nra_rating = row["rating"]
m.full_name = row["full_name"]
m.lastname = row["lastname"]
m.firstname = row["firstname"]
m.state = row["state"]
m.district = row["district"]
m.party = row["party"]
m.congress_office = row["office"]
m.contributions = row["contributions"]
m.save
p m
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment