# Observer questions

**URL:** <https://www.ruby-forum.com/t/observer-questions/158574>\
**Category:** Rails\
**Created:** [January 25, 2009, 6:44am UTC](https://www.ruby-forum.com/t/observer-questions/158574 "2009-01-25T06:44:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [January 25, 2009, 6:44am UTC](https://www.ruby-forum.com/t/observer-questions/158574/1 "2009-01-25T06:44:20Z")

</div>

Hi,  
Re Rails observers, (i.e.  
[http://api.rubyonrails.org/classes/ActiveRecord/Observer.html](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/](http://blog.gregnet.org/)

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [January 25, 2009, 3:18pm UTC](https://www.ruby-forum.com/t/observer-questions/158574/2 "2009-01-25T15:18:28Z")

</div>

it depends on the specific callback in question. the list of available  
callbacks can be found here:

> **[ActiveRecord::Callbacks](https://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html)**
>
> Active Record Callbacks Callbacks are hooks into the life cycle of an Active Record object that allow you to trigger logic before or after a change in the object state.

On Jan 24, 11:43 pm, Greg H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [January 25, 2009, 10:29pm UTC](https://www.ruby-forum.com/t/observer-questions/158574/3 "2009-01-25T22:29:18Z")

</div>

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 B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > clarify:

–  
Greg  
[http://blog.gregnet.org/](http://blog.gregnet.org/)
