method

will_save_change_to_attribute?

Importance_1
v6.0.0 - Show latest stable - 0 notes - Class: ActiveRecord::AttributeMethods::Dirty
will_save_change_to_attribute?(attr_name, **options) public

Will this attribute change the next time we save?

This method is useful in validations and before callbacks to determine if the next call to save will change a particular attribute. It can be invoked as will_save_change_to_name? instead of will_save_change_to_attribute("name").

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 will be changed to the given value

Show source
Register or log in to add new notes.