Forum: Ruby on Rails in after_update, possible to see previous value of record?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
dan kuwachi (Guest)
on 2007-03-10 00:36
(Received via mailing list)
I have this situation where in an after_update, I would like to know
the previous value of the record instead of simply being notified the
record has been updated.

For example let's say I had a table called 'foo' which had a field
'new_flag'.  I want to know when the 'new_flag' field changes from 0 --
> 1 in an after_update so I can do some business logic in the
after_update.  My problem is in the after_update I don't know how to
detect if that particular field got updated.

Is there some api call I can use to access the old object?

on 2007-03-10 04:05
(Received via mailing list)
Use the acts_as_versioned plugin
You can use the API that will allow you to call the previous version
object and access its values.
This topic is locked and can not be replied to.