Hi, Re Rails observers, (i.e. http://api.rubyonrails.org/classes/ActiveRecord/Observer.html ), can anyone clarify: Question - Does the call back for a registered observer occur AFTER or BEFORE the database transaction has completed? (e.g. if I issued a manual rollback call in an observer callback method would it work or be too late to trigger the rollback) -- Greg http://blog.gregnet.org/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
it depends on the specific callback in question. the list of available callbacks can be found here: http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html On Jan 24, 11:43 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > Re Rails observers, (i.e.http://api.rubyonrails.org/classes/ActiveRecord/Observer.html), can anyone > clarify: > > Question - Does the call back for a registered observer occur AFTER or > BEFORE the database transaction has completed? (e.g. if I issued a manual > rollback call in an observer callback method would it work or be too late to > trigger the rollback) > > -- > Greghttp://blog.gregnet.org/--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks - I see even the last one in time, "after_save" says "Note that this callback is still wrapped in the transaction around save", so based on this it should be always possible to issue a manual rollback call in an observer callback method and have it work On Mon, Jan 26, 2009 at 12:17 AM, Andrew Bloom <akbloom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > it depends on the specific callback in question. the list of available > callbacks can be found here: > http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html > > On Jan 24, 11:43 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Hi, > > Re Rails observers, (i.e. > http://api.rubyonrails.org/classes/ActiveRecord/Observer.html), can anyone > > clarify: > > > > Question - Does the call back for a registered observer occur AFTER or > > BEFORE the database transaction has completed? (e.g. if I issued a > manual > > rollback call in an observer callback method would it work or be too late > to > > trigger the rollback) > > > > -- > > Greghttp://blog.gregnet.org/ > > >-- Greg http://blog.gregnet.org/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---