Forum: Ruby on Rails observer questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D5df9fcd7ef4c3c937435d7d6adeab2a?d=identicon&s=25 Greg Hauptmann (Guest)
on 2009-01-25 06:44
(Received via mailing list)
Hi,
Re Rails observers, (i.e.
http://api.rubyonrails.org/classes/ActiveRecord/Ob... ), 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/
6fabb84e727dee98d1277df56458cbac?d=identicon&s=25 Andrew Bloom (Guest)
on 2009-01-25 15:18
(Received via mailing list)
it depends on the specific callback in question. the list of available
callbacks can be found here:
http://api.rubyonrails.org/classes/ActiveRecord/Ca...

On Jan 24, 11:43 pm, Greg Hauptmann <greg.hauptmann.r...@gmail.com>
D5df9fcd7ef4c3c937435d7d6adeab2a?d=identicon&s=25 Greg Hauptmann (Guest)
on 2009-01-25 22:29
(Received via mailing list)
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@gmail.com>
wrote:

> > clarify:
> >
>


--
Greg
http://blog.gregnet.org/
This topic is locked and can not be replied to.