Class: Thredded::DatabaseSeeder::PrivateTopics

Inherits:
CollectionSeedData show all
Defined in:
lib/thredded/database_seeder.rb

Constant Summary collapse

MODEL_CLASS =
PrivateTopic

Instance Attribute Summary

Attributes inherited from BaseSeedData

#seeder

Instance Method Summary collapse

Methods inherited from CollectionSeedData

#find

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) ⇒ Object



235
236
237
238
239
240
241
242
243
244
# File 'lib/thredded/database_seeder.rb', line 235

def create(count: 1)
  Array.new(count) do
    FactoryBot.create(
      :private_topic,
      user: seeder.users[1..-1].sample,
      last_user: seeder.users.sample,
      users: [seeder.first_user, *seeder.users.sample(1 + rand(3))]
    )
  end
end