Files
nairobi/db/dev_seeds/communities.rb
Javi Martín 102cf74b3d Bump faker from 1.8.7 to 2.0
Since version 2.0 introduced many breaking changes, we're upgrading to
it first.

The changes have been done by installing the rubocop-faker gem and
running:

```
rubocop \
  --require rubocop-faker \
  --only Faker/DeprecatedArguments \
  --auto-correct
```
2021-08-13 04:39:44 +02:00

23 lines
795 B
Ruby

section "Creating Communities" do
Proposal.find_each { |proposal| proposal.update(community: Community.create) }
Budget::Investment.find_each { |investment| investment.update(community: Community.create) }
end
section "Creating Communities Topics" do
Community.find_each do |community|
Topic.create(community: community, author: User.all.sample,
title: Faker::Lorem.sentence(word_count: 3).truncate(60), description: Faker::Lorem.sentence)
end
end
section "Commenting Community Topics" do
30.times do
author = User.all.sample
topic = Topic.all.sample
Comment.create!(user: author,
created_at: rand(topic.created_at..Time.current),
commentable: topic,
body: Faker::Lorem.sentence)
end
end