minimum_count = 10 if Redshop::Category.count < minimum_count minimum_count.times do Redshop::Category.create!(name: Faker::Lorem.word)#, preview: Faker::Avatar.image, background: Faker::Placeholdit.image) end end if Redshop::Product.count < minimum_count minimum_count.times do Redshop::Product.create!(name: Faker::Lorem.word, desc: Faker::Lorem.sentence, price: rand(1..100), category: Redshop::Category.all.sample, rating: rand(1.1..4.9), image: Faker::Avatar.image) end end