That's why we have after_commit in Rails 3. ;) Sent from my iPhone
On Sep 2, 2010, at 6:39 PM, Michael Koziarski <[email protected]> wrote: >> In my mind, observer callbacks should not be fired inside the AR transaction >> to avoid race conditions when observers kick of processes that try and >> access the new model before all the callbacks have completed and the >> transaction is committed. > > You could make the same argument about regular callbacks though, > after_create could be used to kick off jobs etc. I can see arguments > on both sides, observers are a different object so having a slightly > detached lifecycle makes sense. But at the same time it's really just > an organisation method, so why is there a difference. > >> Any thoughts? > > Is it fair to say that the best fix would be another specific hook > which fires after the transaction is successfully committed? > >> >> Tekin Suleyman >> http://tekin.co.uk >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" 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-core?hl=en. >> > > > > -- > Cheers > > Koz > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" 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-core?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en.
