daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top