Tuesday, May 24, 2011

[Rails] Re: Execute after_save callback only if an attribute is modified

My bad. You are correct. I'm not sure why I thought otherwise, but I
did a simple test and the flags are indeed not cleared until after all
the callbacks are run. Sorry for the confusion - must have been a
different bug.

On May 24, 4:42 am, Matt Jones <al2o...@gmail.com> wrote:
> On May 23, 5:10 pm, Alex N <a...@liivid.com> wrote:
>
> > I'd like to do something like:
>
> > after_save :get_url, :if => url_changed?
>
> > but this won't work because the url is no longer "dirty" after the
> > save.
>
> Have you tried this? Unless something's broken, the dirty attributes
> shouldn't be cleared until *after* all the callbacks run.
>
> --Matt Jones

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate