method

saved_change_to_attribute?

Importance_1
v5.1.7 - Show latest stable - 0 notes - Class: ActiveRecord::AttributeMethods::Dirty
saved_change_to_attribute?(attr_name, **options) public

Did this attribute change when we last saved? This method can be invoked as `saved_change_to_name?` instead of `saved_change_to_attribute?(“name”)`. Behaves similarly to attribute_changed?. This method is useful in after callbacks to determine if the call to save changed a certain attribute.

Options

from When passed, this method will return false unless the original value is equal to the given option

to When passed, this method will return false unless the value was changed to the given value

Show source
Register or log in to add new notes.