Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'csv'
- task import: :environment do
- csv = CSV.foreach('/home/diego/work/data/itcont.txt') do |row|
- ActiveRecord::Base.transaction do
- t = Transaction.new
- t.build_contributor(name: row[7], city: row[8], state: row[9], zip_code: row[10], employer: row[11], occupation: row[12])
- t.build_contribution(cmte_id: row[0])
- t.save
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement