updates dev seeds with comments for poll questions

This commit is contained in:
rgarcia
2016-11-18 20:35:05 +01:00
parent e21eb9d02c
commit b48ee1c7a2

View File

@@ -403,4 +403,15 @@ end
10.times.each_with_index do |i|
Poll::Booth.create(name: "Booth #{i}", poll: Poll.all.sample)
end
puts "Commenting Poll Questions"
(1..30).each do |i|
author = User.reorder("RANDOM()").first
question = Poll::Question.reorder("RANDOM()").first
Comment.create!(user: author,
created_at: rand(question.created_at .. Time.now),
commentable: question,
body: Faker::Lorem.sentence)
end