Module: ActiveRecord::AttributeMethods::Dirty
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Dirty
- Defined in:
- lib/active_record/attribute_methods/dirty.rb
Overview
:nodoc:
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.
48 49 50 51 52 53 |
# File 'lib/active_record/attribute_methods/dirty.rb', line 48 def reload(*) super.tap do @previously_changed.clear @changed_attributes.clear end end |
#save ⇒ Object
Attempts to save
the record and clears changed attributes if successful.
31 32 33 34 35 36 37 |
# File 'lib/active_record/attribute_methods/dirty.rb', line 31 def save(*) 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.
40 41 42 43 44 45 |
# File 'lib/active_record/attribute_methods/dirty.rb', line 40 def save!(*) super.tap do @previously_changed = changes @changed_attributes.clear end end |