Module: ActiveLayer::Persistence::InstanceMethods
- Defined in:
- lib/active_layer/persistence.rb
Instance Method Summary collapse
-
#active_layer_attributes_setting(new_attributes) ⇒ Object
another hook method to control attributes=.
-
#active_layer_save ⇒ Object
hook method to override saving behaviour.
- #save ⇒ Object
- #save! ⇒ Object
- #update_attributes(new_attributes) ⇒ Object
- #update_attributes!(new_attributes) ⇒ Object
Instance Method Details
#active_layer_attributes_setting(new_attributes) ⇒ Object
another hook method to control attributes=
54 55 56 |
# File 'lib/active_layer/persistence.rb', line 54 def active_layer_attributes_setting(new_attributes) active_layer_object.attributes = new_attributes end |
#active_layer_save ⇒ Object
hook method to override saving behaviour
49 50 51 |
# File 'lib/active_layer/persistence.rb', line 49 def active_layer_save active_layer_object.save end |
#save ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/active_layer/persistence.rb', line 22 def save valid = self.respond_to?(:valid?, false) ? valid? : true if valid active_layer_save else false end end |
#save! ⇒ Object
32 33 34 35 36 |
# File 'lib/active_layer/persistence.rb', line 32 def save! unless save raise RecordInvalidError.new(self) end end |
#update_attributes(new_attributes) ⇒ Object
38 39 40 41 |
# File 'lib/active_layer/persistence.rb', line 38 def update_attributes(new_attributes) active_layer_attributes_setting(new_attributes) save end |
#update_attributes!(new_attributes) ⇒ Object
43 44 45 46 |
# File 'lib/active_layer/persistence.rb', line 43 def update_attributes!(new_attributes) active_layer_attributes_setting(new_attributes) save! end |