Skip to content

Instantly share code, notes, and snippets.

@colleowino
Created October 23, 2017 21:52
Show Gist options
  • Save colleowino/8345b1d425fa35e4a5493ba631ab086a to your computer and use it in GitHub Desktop.
Save colleowino/8345b1d425fa35e4a5493ba631ab086a to your computer and use it in GitHub Desktop.
rails seeder using ffaker gem
# require 'ffaker'
items = ["beans", "maize", "tea"]
items.each do |item|
# each item should have an entry for each month
1.upto(12) do |month|
month_date = "2015-"+month.to_s+"-20 20:00:00"
Report.create( item: item, report_date: month_date, price: rand(100) )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment