Guest User

Untitled

a guest
Mar 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. def import_csv
  2. #This section is totally fucked and needs major work.
  3. csv_file = '/home/matthew/sample.csv'
  4. row_count=0
  5. FasterCSV.foreach( csv_file ) do |row|
  6. row_count += 1
  7. if row_count != 1
  8. this_row = {:checked => row[0],
  9. :effective_date => row[1],
  10. :category_id => row[2],
  11. :comment => row[3],
  12. :check_number => row[4],
  13. :value => row[5]
  14. }
  15. @newEntry = Entry.new(this_row)
  16. @newEntry.save!
  17. end
  18. end
  19. end
  20.  
  21.  
  22. here is the error:
  23.  
  24. ActiveRecord::RecordInvalid in AccountController#import_csv
  25.  
  26. Validation failed: Value can't be blank, Effective date can't be blank
Add Comment
Please, Sign In to add comment