Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- csv = CSV.parse(csv_text, :headers => true)
- CSV::MalformedCSVError: Missing or stray quote in line 1
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1872:in `block (2 levels) in shift'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1845:in `each'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1845:in `block in shift'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1805:in `loop'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1805:in `shift'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1747:in `each'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1761:in `to_a'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1761:in `read'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1307:in `parse'
- from (irb):4
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
- from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `require'
- from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `<top (required)>'
- from -e:1:in `load'
- from -e:1:in `<main>'
- csv.each do |row|
- Prediction.create!(product_id: row[0], out_of_stock: row[1], need_to_order: row[2], book_count: row[3])
- end
- NoMethodError: undefined method `each' for nil:NilClass
- from (irb):5
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
- from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
- from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `require'
- from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `<top (required)>'
- from -e:1:in `load'
- from -e:1:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement