Hi Everyone,
Is there a way to when you find a record to keep the original value of
the attributes. This would allow to see if an attribute has changed at
save time and then do something. I am sure there is an cool way in
rails to do this!
Thanks…
On Jan 19, 2008 11:30 PM, nigel.bris [email protected] wrote:
Hi Everyone,
Is there a way to when you find a record to keep the original value of
the attributes. This would allow to see if an attribute has changed at
save time and then do something. I am sure there is an cool way in
rails to do this!
You can store it in the #after_find hook:
class Thing < ActiveRecord::Base
def after_find
@original_name = name
end
end
Have a look at acts_as_audited it does exactly what you want.
Ryan B.
Feel free to add me to MSN and/or GTalk as this email.
Both brilliant options… Thank you for your help!