Class: Thredded::DatabaseSeeder::BaseSeedData

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

Direct Known Subclasses

CollectionSeedData, FirstSeedData

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seed_database = DatabaseSeeder.new) ⇒ BaseSeedData

Returns a new instance of BaseSeedData.



136
137
138
# File 'lib/thredded/database_seeder.rb', line 136

def initialize(seed_database = DatabaseSeeder.new)
  @seeder = seed_database
end

Instance Attribute Details

#seederObject (readonly)

Returns the value of attribute seeder.



134
135
136
# File 'lib/thredded/database_seeder.rb', line 134

def seeder
  @seeder
end

Class Method Details

.create(*args) ⇒ Object

Utility method



141
142
143
# File 'lib/thredded/database_seeder.rb', line 141

def self.create(*args)
  new.create(*args)
end

Instance Method Details

#find_or_create(*args) ⇒ Object



147
148
149
150
# File 'lib/thredded/database_seeder.rb', line 147

def find_or_create(*args)
  return @stored if @stored
  @stored = (find || create(*args))
end