Slide 38
Slide 38 text
db/seeds.rb:
Category.create(name: "A")
Category.create(name: "B")
Category.create(name: "C")
100.times do
Product.create(name: Faker::Food.dish,
description: Faker::Food.description,
category: Category.all.sample,
price: rand(20))
end
50.times do
user = User.create(first_name: Faker::Name.first_name,
last_name: Faker::Name.last_name)
products = Product.all
3.times do
Review.create(user: user,
product: products.sample,
rating: rand(5))
end
end