Skip to content

Instantly share code, notes, and snippets.

@austenito
Created May 6, 2013 18:26
Show Gist options
  • Select an option

  • Save austenito/5527039 to your computer and use it in GitHub Desktop.

Select an option

Save austenito/5527039 to your computer and use it in GitHub Desktop.
delimited file reader
require "csv"
class DelimitedReader
def self.run(filename)
counter = 0
CSV.foreach(filename, { :headers => true }) do |row|
Merchant.find(row[0]).update_attribute(:merchant_profile_id, row[1])
counter += 1
if counter > 999
puts "."
sleep(0.1)
counter = 0
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment