# Callback on update but not on destroy

**URL:** <https://www.ruby-forum.com/t/callback-on-update-but-not-on-destroy/156190>\
**Category:** Rails\
**Created:** [December 22, 2008, 2:51pm UTC](https://www.ruby-forum.com/t/callback-on-update-but-not-on-destroy/156190 "2008-12-22T14:51:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [December 22, 2008, 2:51pm UTC](https://www.ruby-forum.com/t/callback-on-update-but-not-on-destroy/156190/1 "2008-12-22T14:51:23Z")

</div>

Hi,

Does anyone know if there’s a callback that gets called when a  
existing record gets updated but not when a record gets destroyed?  
After\_update and before\_update seem to also get called on destroy. I  
there is no such a callback can anybody suggest an alternative way of  
triggering a method when a record gets updated unless the record gets  
destroyed?

---

<div class="post-metadata">

**Author:** ![japj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@japj](https://www.ruby-forum.com/u/japj)\
**Post date:** [December 22, 2008, 7:51pm UTC](https://www.ruby-forum.com/t/callback-on-update-but-not-on-destroy/156190/2 "2008-12-22T19:51:51Z")

</div>

jeroen wrote:

> Does anyone know if there’s a callback that gets called when a  
> existing record gets updated but not when a record gets destroyed?  
> After\_update and before\_update seem to also get called on destroy. I  
> there is no such a callback can anybody suggest an alternative way of  
> triggering a method when a record gets updated unless the record gets  
> destroyed?

The update callbacks aren’t called on destroy.  
Are you sure you’re not doing an update you’re not aware of.  
Can you see such an update in your SQL logs?

–  
Rails Wheels - Find Plugins, List & Sell Plugins -  
[http://railswheels.com](http://railswheels.com)
