Class: Thredded::DatabaseSeeder::PrivatePosts

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

Constant Summary collapse

MODEL_CLASS =
PrivatePost

Instance Attribute Summary

Attributes inherited from BaseSeedData

#seeder

Instance Method Summary collapse

Methods inherited from CollectionSeedData

#find

Methods inherited from BaseSeedData

#find_or_create, #initialize

Constructor Details

This class inherits a constructor from Thredded::DatabaseSeeder::BaseSeedData

Instance Method Details

#create(count: (1..1)) ⇒ Object



268
269
270
271
272
273
274
275
# File 'lib/thredded/database_seeder.rb', line 268

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
      FactoryGirl.create(:private_post, postable: topic, user: seeder.users.sample)
    end
  end
end