Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def import_csv
- #This section is totally fucked and needs major work.
- csv_file = '/home/matthew/sample.csv'
- row_count=0
- FasterCSV.foreach( csv_file ) do |row|
- row_count += 1
- if row_count != 1
- this_row = {:checked => row[0],
- :effective_date => row[1],
- :category_id => row[2],
- :comment => row[3],
- :check_number => row[4],
- :value => row[5]
- }
- @newEntry = Entry.new(this_row)
- @newEntry.save!
- end
- end
- end
- here is the error:
- ActiveRecord::RecordInvalid in AccountController#import_csv
- Validation failed: Value can't be blank, Effective date can't be blank
Add Comment
Please, Sign In to add comment