Class: SmartSeeds::Performing
- Inherits:
-
Object
- Object
- SmartSeeds::Performing
- Defined in:
- lib/smart_seeds/performing.rb
Instance Method Summary collapse
-
#initialize(model, attrs) ⇒ Performing
constructor
A new instance of Performing.
- #start ⇒ Object
Constructor Details
#initialize(model, attrs) ⇒ Performing
3 4 5 6 7 8 |
# File 'lib/smart_seeds/performing.rb', line 3 def initialize(model, attrs) @attrs = attrs @model = model @object = model.new @skippable_attributes = %w(id created_at updated_at) end |
Instance Method Details
#start ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/smart_seeds/performing.rb', line 10 def start add_skippable_attributes set_default_values # User can send custom values in a hash: SmartSeeds.(Entity, {name: 'Aleah'}) # This method overrides default values to custom('name' in the example above) set_custom_values if attrs.any? object.save! object end |