Using ActiveRecord, is there a way to get the old values of a record during after_update

Ditto what everyone is saying about transactions.

That said…

ActiveRecord as of Rails 2.1 keeps track of the attribute values of an object. So if you have an attribute total, you will have a total_changed? method and a total_was method that returns the old value.

There’s no need to add anything to your model to keep track of this anymore.

Update: Here is the documentation for ActiveModel::Dirty as requested.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)