Class: Thredded::DatabaseSeeder::BaseSeedData
- Inherits:
-
Object
- Object
- Thredded::DatabaseSeeder::BaseSeedData
- Defined in:
- lib/thredded/database_seeder.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#seeder ⇒ Object
readonly
Returns the value of attribute seeder.
Class Method Summary collapse
-
.create(*args) ⇒ Object
Utility method.
Instance Method Summary collapse
- #find_or_create(*args) ⇒ Object
-
#initialize(seed_database = DatabaseSeeder.new) ⇒ BaseSeedData
constructor
A new instance of BaseSeedData.
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
#seeder ⇒ Object (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 |