updates dev seed with archived proposals

This commit is contained in:
rgarcia
2016-09-16 20:24:25 +02:00
parent 782aa2e4d8
commit 0c873649c5

View File

@@ -162,6 +162,27 @@ tags = Faker::Lorem.words(25)
puts " #{proposal.title}"
end
puts "Creating Archived Proposals"
tags = Faker::Lorem.words(25)
(1..5).each do |i|
author = User.reorder("RANDOM()").first
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
question: Faker::Lorem.sentence(3) + "?",
summary: Faker::Lorem.sentence(3),
responsible_name: Faker::Name.name,
external_url: Faker::Internet.url,
description: description,
created_at: rand((Time.now - 1.week) .. Time.now),
tag_list: tags.sample(3).join(','),
geozone: Geozone.reorder("RANDOM()").first,
terms_of_service: "1",
created_at: Setting["months_to_archive_proposals"].to_i.months.ago)
puts " #{proposal.title}"
end
tags = ActsAsTaggableOn::Tag.where(kind: 'category')
(1..30).each do |i|