I have an object (call it an 'emitter'), that has_many 'emissions'
objects.

Each time I save an emission for a certain emitter, I need to do work
on the entire set of emissions for that emitter, including the new
emission.

I do this work in the emissions after_save handler. My problem arises
because, per the rails documentation, the newly saved emission is not
actually saved until after the after_save returns.

Trying to be clever, before doing anyhting else in the after_save
handler, I just pushed the newly saved emission onto the list of
emissions in memory:
emitter.emissions << self

So - that works just great, as long as I never reload the emitter's
emissions (emitter.reload). If I do, then my new emission is gone.

Is there any way to force the new emission to really save in the
database before the after_save handler completes?

Thanks,
Yoram

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

Reply via email to