Class: Thredded::DatabaseSeeder::Users

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

Overview

Thredded::DatabaseSeeder::Users.create(count:200)

Constant Summary collapse

MODEL_CLASS =
User

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



195
196
197
198
199
200
201
# File 'lib/thredded/database_seeder.rb', line 195

def create(count: 1)
  log "Creating #{count} users..."
  approved_users_count = (count * 0.97).round
  [seeder.first_user] +
    FactoryBot.create_list(:user, approved_users_count, :approved) +
    FactoryBot.create_list(:user, count - approved_users_count)
end