On 10 Nov 2008, at 09:02, scott wrote:
>
> in a before_update is there an easy way to check if a specific field
> is being changed?
>
> for example
>
> def before_update
> unless current.email == new.email
> # do stuff
> end
> end
>
> obviously "current.email" and "new.email" are wrong. i
am guessing one
> will be "self.email", what would the other be?
from 2.1 onwards you''ll get an email_changed? method for free.
Fred
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---