Created
August 28, 2016 00:42
-
-
Save toniesteves/353dc799c7a53b477496232e61eb4996 to your computer and use it in GitHub Desktop.
This file contains 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
def create | |
@archive = Archive.new(archive_params) | |
@archive.receipt = 0; | |
options = {:col_sep => "\t", :row_sep => "\n"} | |
SmarterCSV.process(archive_params[:attachment].path,options) do |chunk| | |
chunk.each do |data_hash| | |
@archive.receipt += data_hash[:price] | |
Order.create!( data_hash ) | |
end | |
end | |
if @archive.save | |
redirect_to archives_path, notice: "The resume #{@archive.name} has been uploaded." | |
else | |
render "new" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment