Module: ActiveRecord::AttributeMethods::Dirty
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Dirty, Write
- Defined in:
- lib/active_record/attribute_methods/dirty.rb
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.
37 38 39 40 41 42 |
# File 'lib/active_record/attribute_methods/dirty.rb', line 37 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.
20 21 22 23 24 25 26 |
# File 'lib/active_record/attribute_methods/dirty.rb', line 20 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/active_record/attribute_methods/dirty.rb', line 29 def save!(*) #:nodoc: super.tap do @previously_changed = changes @changed_attributes.clear end end |