Created
May 6, 2013 18:26
-
-
Save austenito/5527039 to your computer and use it in GitHub Desktop.
delimited file reader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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