diff --git a/db/dev_seeds/debates.rb b/db/dev_seeds/debates.rb index bda70f028..9422f0985 100644 --- a/db/dev_seeds/debates.rb +++ b/db/dev_seeds/debates.rb @@ -3,25 +3,40 @@ section "Creating Debates" do 30.times do author = User.all.sample description = "
#{Faker::Lorem.paragraphs.join("
")}
" - Debate.create!(author: author, - title: Faker::Lorem.sentence(3).truncate(60), - created_at: rand((Time.current - 1.week)..Time.current), - description: description, - tag_list: tags.sample(3).join(","), - geozone: Geozone.all.sample, - terms_of_service: "1") + debate = Debate.create!(author: author, + title: Faker::Lorem.sentence(3).truncate(60), + created_at: rand((Time.current - 1.week)..Time.current), + description: description, + tag_list: tags.sample(3).join(","), + geozone: Geozone.all.sample, + terms_of_service: "1") + random_locales.map do |locale| + Globalize.with_locale(locale) do + debate.title = "Title for locale #{locale}" + debate.description = "Description for locale #{locale}
" + debate.save! + end + end end tags = ActsAsTaggableOn::Tag.where(kind: "category") 30.times do author = User.all.sample description = "#{Faker::Lorem.paragraphs.join("
")}
" - Debate.create!(author: author, - title: Faker::Lorem.sentence(3).truncate(60), - created_at: rand((Time.current - 1.week)..Time.current), - description: description, - tag_list: tags.sample(3).join(","), - geozone: Geozone.all.sample, - terms_of_service: "1") + + debate = Debate.create!(author: author, + title: Faker::Lorem.sentence(3).truncate(60), + created_at: rand((Time.current - 1.week)..Time.current), + description: description, + tag_list: tags.sample(3).join(","), + geozone: Geozone.all.sample, + terms_of_service: "1") + random_locales.map do |locale| + Globalize.with_locale(locale) do + debate.title = "Title for locale #{locale}" + debate.description = "Description for locale #{locale}
" + debate.save! + end + end end end