Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Created March 27, 2012 00:16
Show Gist options
  • Save luckyruby/2210920 to your computer and use it in GitHub Desktop.
Save luckyruby/2210920 to your computer and use it in GitHub Desktop.
require 'csv'
desc "Imports Vendors"
task :import_vendors => :environment do
CSV.foreach("#{Rails.root}/public/system/vendors.csv") do |row|
vendor = Vendor.create(
:name => row[0],
:iata => row[1].to_i,
:address => row[2],
:address2 => row[3],
:city => row[4],
:zipcode => row[5],
:state => row[6],
:country => row[7],
:phone => row[8]
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment