Module: Cardiac::Model::Dirty
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Dirty
- Included in:
- Base
- Defined in:
- lib/cardiac/model/dirty.rb
Overview
Cardiac::Model dirty attribute methods. Some of this has been “borrowed” from ActiveRecord.
Instance Method Summary collapse
-
#reload ⇒ Object
reload
the record and clears changed attributes. -
#save ⇒ Object
Attempts to
save
the record and clears changed attributes if successful. -
#save! ⇒ Object
Attempts to
save!
the record and clears changed attributes if successful.
Instance Method Details
#reload ⇒ Object
reload
the record and clears changed attributes.
39 40 41 42 43 44 |
# File 'lib/cardiac/model/dirty.rb', line 39 def reload(*) #:nodoc: super.tap do @previously_changed.clear @changed_attributes.clear end end |
#save ⇒ Object
Attempts to save
the record and clears changed attributes if successful.
18 19 20 21 22 23 24 |
# File 'lib/cardiac/model/dirty.rb', line 18 def save(*) #:nodoc: if status = super @previously_changed = changes @changed_attributes.clear end status end |
#save! ⇒ Object
Attempts to save!
the record and clears changed attributes if successful.
29 30 31 32 33 34 |
# File 'lib/cardiac/model/dirty.rb', line 29 def save!(*) #:nodoc: super.tap do @previously_changed = changes @changed_attributes.clear end end |