Advertisement
ondrej1003

Untitled

Oct 29th, 2016
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 2.75 KB | None | 0 0
  1. csv = CSV.parse(csv_text, :headers => true)
  2. CSV::MalformedCSVError: Missing or stray quote in line 1
  3.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1872:in `block (2 levels) in shift'
  4.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1845:in `each'
  5.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1845:in `block in shift'
  6.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1805:in `loop'
  7.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1805:in `shift'
  8.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1747:in `each'
  9.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1761:in `to_a'
  10.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1761:in `read'
  11.     from /home/ondrej/.rbenv/versions/2.3.1/lib/ruby/2.3.0/csv.rb:1307:in `parse'
  12.     from (irb):4
  13.     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'
  14.     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'
  15.     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'
  16.     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!'
  17.     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)>'
  18.     from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `require'
  19.     from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `<top (required)>'
  20.     from -e:1:in `load'
  21.     from -e:1:in `<main>'
  22. csv.each do |row|
  23.   Prediction.create!(product_id: row[0], out_of_stock: row[1], need_to_order: row[2], book_count: row[3])
  24. end
  25. NoMethodError: undefined method `each' for nil:NilClass
  26.     from (irb):5
  27.     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'
  28.     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'
  29.     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'
  30.     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!'
  31.     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)>'
  32.     from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `require'
  33.     from /home/ondrej/RubymineProjects/Smart-Store2/bin/rails:9:in `<top (required)>'
  34.     from -e:1:in `load'
  35.     from -e:1:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement