Module: ActiveRecord::AttributeMethods::Dirty
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Dirty, Write
- Defined in:
- activerecord/lib/active_record/attribute_methods/dirty.rb
Instance Method Summary (collapse)
-
- (Object) reload
reload the record and clears changed attributes.
-
- (Object) save
Attempts to save the record and clears changed attributes if successful.
-
- (Object) save!
Attempts to save! the record and clears changed attributes if successful.
Methods included from ActiveSupport::Concern
append_features, extended, included
Methods included from ActiveModel::Dirty
#changed, #changed?, #changed_attributes, #changes, #previous_changes
Methods included from ActiveModel::AttributeMethods
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveModel::AttributeMethods
Instance Method Details
- (Object) reload
reload the record and clears changed attributes.
37 38 39 40 41 42 |
# File 'activerecord/lib/active_record/attribute_methods/dirty.rb', line 37 def reload(*) #:nodoc: super.tap do @previously_changed.clear @changed_attributes.clear end end |
- (Object) save
Attempts to save the record and clears changed attributes if successful.
20 21 22 23 24 25 26 |
# File 'activerecord/lib/active_record/attribute_methods/dirty.rb', line 20 def save(*) #:nodoc: if status = super @previously_changed = changes @changed_attributes.clear end status end |
- (Object) save!
Attempts to save! the record and clears changed attributes if successful.
29 30 31 32 33 34 |
# File 'activerecord/lib/active_record/attribute_methods/dirty.rb', line 29 def save!(*) #:nodoc: super.tap do @previously_changed = changes @changed_attributes.clear end end |