Class: Thredded::DatabaseSeeder::PrivatePosts
- Inherits:
-
CollectionSeedData
- Object
- BaseSeedData
- CollectionSeedData
- Thredded::DatabaseSeeder::PrivatePosts
- Defined in:
- lib/thredded/database_seeder.rb
Constant Summary collapse
- MODEL_CLASS =
PrivatePost
Instance Attribute Summary
Attributes inherited from BaseSeedData
Instance Method Summary collapse
Methods inherited from CollectionSeedData
Methods inherited from BaseSeedData
create, #find_or_create, #initialize
Constructor Details
This class inherits a constructor from Thredded::DatabaseSeeder::BaseSeedData
Instance Method Details
#create(count: (1..1)) ⇒ Object
278 279 280 281 282 283 284 285 286 |
# File 'lib/thredded/database_seeder.rb', line 278 def create(count: (1..1)) log "Creating #{count} additional posts in each private topic..." seeder.private_topics.flat_map do |topic| (count.min + rand(count.max + 1)).times do |i| = i.zero? ? topic.user : topic.users.sample FactoryBot.create(:private_post, postable: topic, user: ) end end end |