Created
June 5, 2013 20:45
-
-
Save TXDynamics/5717180 to your computer and use it in GitHub Desktop.
Ruby on Rails: Import a csv file into a database and adding an additional static value column
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
file_path = 'public/uploads/' + filename | |
marketer = Marketer.find(marketer_id) | |
CSV.foreach(file_path, headers: true) do |row| | |
MarketerImport.create! row.to_hash.merge(new_user: marketer.slx_id) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment