Advertisement
ondrej1003

Untitled

Oct 29th, 2016
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.26 KB | None | 0 0
  1. require 'csv'
  2. subor = "#{Rails.root}/public/current_output.csv"
  3. csv_text = File.read(subor)
  4. csv = CSV.parse(csv_text, :headers => true)
  5. csv.each do |row|
  6.   Prediction.create!(product_id: row[0], out_of_stock: row[1], need_to_order: row[2], book_count: row[3])
  7. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement