Module: ActiveRecord::AttributeMethods::Dirty
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Dirty
- Defined in:
- activerecord/lib/active_record/attribute_methods/dirty.rb
Overview
:nodoc:
Constant Summary
Constants included from ActiveModel::AttributeMethods
ActiveModel::AttributeMethods::CALL_COMPILABLE_REGEXP, ActiveModel::AttributeMethods::NAME_COMPILABLE_REGEXP
Instance Method Summary collapse
-
#initialize_dup(other) ⇒ Object
:nodoc:.
-
#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.
Methods included from ActiveSupport::Concern
append_features, extended, included
Methods included from ActiveModel::Dirty
#attribute_changed?, #attribute_was, #changed, #changed?, #changed_attributes, #changes, #previous_changes
Methods included from ActiveModel::AttributeMethods
#attribute_missing, #method_missing, #respond_to?, #respond_to_without_attributes?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveModel::AttributeMethods
Instance Method Details
#initialize_dup(other) ⇒ Object
:nodoc:
41 42 43 44 |
# File 'activerecord/lib/active_record/attribute_methods/dirty.rb', line 41 def initialize_dup(other) # :nodoc: super init_changed_attributes end |
#reload ⇒ Object
reload
the record and clears changed attributes.
35 36 37 38 39 |
# File 'activerecord/lib/active_record/attribute_methods/dirty.rb', line 35 def reload(*) super.tap do reset_changes end end |
#save ⇒ Object
Attempts to save
the record and clears changed attributes if successful.
20 21 22 23 24 25 |
# File 'activerecord/lib/active_record/attribute_methods/dirty.rb', line 20 def save(*) if status = super changes_applied end status end |
#save! ⇒ Object
Attempts to save!
the record and clears changed attributes if successful.
28 29 30 31 32 |
# File 'activerecord/lib/active_record/attribute_methods/dirty.rb', line 28 def save!(*) super.tap do changes_applied end end |