Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'csv'
- subor = "#{Rails.root}/public/current_output.csv"
- csv_text = File.read(subor)
- csv = CSV.parse(csv_text, :headers => true)
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement