method

attribute_in_database

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveRecord::AttributeMethods::Dirty
attribute_in_database(attr_name) public

Returns the value of an attribute in the database, as opposed to the in-memory value that will be persisted the next time the record is saved.

This method is useful in validations and before callbacks, to see the original value of an attribute prior to any changes about to be saved. It can be invoked as name_in_database instead of attribute_in_database("name").

Show source
Register or log in to add new notes.