method
save_changed_attribute
v4.1.8 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods::Dirty
save_changed_attribute(attr, value)private
No documentation available.
# File activerecord/lib/active_record/attribute_methods/dirty.rb, line 71
def save_changed_attribute(attr, value)
# The attribute already has an unsaved change.
if attribute_changed?(attr)
old = changed_attributes[attr]
changed_attributes.delete(attr) unless _field_changed?(attr, old, value)
else
old = clone_attribute_value(:read_attribute, attr)
changed_attributes[attr] = old if _field_changed?(attr, old, value)
end
end