Class: DirtySeed::Seeder
- Inherits:
-
Object
- Object
- DirtySeed::Seeder
- Defined in:
- lib/dirty_seed/seeder.rb
Overview
Represents an Active Record model
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
-
#initialize(model) ⇒ DirtySeed::Seeder
constructor
Initializes an record.
-
#seed(qty = 1) ⇒ Array<Object>
Creates records.
Constructor Details
#initialize(model) ⇒ DirtySeed::Seeder
Initializes an record
11 12 13 14 15 |
# File 'lib/dirty_seed/seeder.rb', line 11 def initialize(model) @model = model @records = [] @errors = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/dirty_seed/seeder.rb', line 6 def errors @errors end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/dirty_seed/seeder.rb', line 6 def model @model end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
6 7 8 |
# File 'lib/dirty_seed/seeder.rb', line 6 def records @records end |
Instance Method Details
#seed(qty = 1) ⇒ Array<Object>
Creates records
20 21 22 23 24 25 |
# File 'lib/dirty_seed/seeder.rb', line 20 def seed(qty = 1) self.quantity = qty logger.(model) create_records records end |