# About ActiveRecord callback

**URL:** <https://www.ruby-forum.com/t/about-activerecord-callback/192497>\
**Category:** Rails\
**Created:** [July 31, 2010, 6:11pm UTC](https://www.ruby-forum.com/t/about-activerecord-callback/192497 "2010-07-31T18:11:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [July 31, 2010, 6:11pm UTC](https://www.ruby-forum.com/t/about-activerecord-callback/192497/1 "2010-07-31T18:11:17Z")

</div>

The callback after\_update() doc is following:  
#######  
after\_update()

Is called after Base.save on existing objects that have a record. Note  
that this callback is still wrapped in the transaction around save. For  
example, if you invoke an external indexer at this point it wonâ€™t see  
the changes in the database.  
########  
But i don’t understand “Note that this callback is still wrapped in the  
transaction around save”.  
So my following understanding is right?  
if exception occurs when saving the existing record, or when executing  
after\_update method body,both the existing record’s saving and sql  
statements in the after\_update method body are all rollbacked?

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [August 1, 2010, 6:50am UTC](https://www.ruby-forum.com/t/about-activerecord-callback/192497/2 "2010-08-01T06:50:36Z")

</div>

On 2010-07-31 18:11, Guo Y. wrote:

> So my following understanding is right?  
> if exception occurs when saving the existing record, or when executing  
> after\_update method body,both the existing record’s saving and sql  
> statements in the after\_update method body are all rollbacked?

## Right. If you see something different, it would be a bug.

Nick

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [August 1, 2010, 7:26am UTC](https://www.ruby-forum.com/t/about-activerecord-callback/192497/3 "2010-08-01T07:26:52Z")

</div>

thanks,Nick.But can you help me the question about “handle exception in  
ajax call”?
