Hi,
Is it possible to know in a callback to know which attributes were
updated?
I want to do stuff only if one attribute has been updated.
Greg
Hi,
Is it possible to know in a callback to know which attributes were
updated?
I want to do stuff only if one attribute has been updated.
Greg
On Dec 30, 1:40pm, Greg Ma [email protected] wrote:
Hi,
Is it possible to know in a callback to know which attributes were
updated?
I want to do stuff only if one attribute has been updated.
The changed and changes methods lists changed attributes. There are
also invididual predicate methods, eg name_changed?
Fred
Frederick C. wrote in post #971451:
On Dec 30, 1:40pm, Greg Ma [email protected] wrote:
Hi,
Is it possible to know in a callback to know which attributes were
updated?
I want to do stuff only if one attribute has been updated.The changed and changes methods lists changed attributes. There are
also invididual predicate methods, eg name_changed?Fred
Thanks I didn’t know that one!
But this will work in a before_* and not after_*
On Thu, Dec 30, 2010 at 7:59 AM, Greg Ma [email protected] wrote:
Fred
Thanks I didn’t know that one!
Yeah me too, that’s very cool, I actually have the perfect place to
apply it
today
Yes, this is a very handy feature of ActiveRecord in Rails!
Let me summarize here some related methods that come up to my mind:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs