Forum: Ruby on Rails Callback on update but not on destroy

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.
D75f4b92f64038bcb02995694c1c9984?d=identicon&s=25 Jeroen Janssen (joran)
on 2008-12-22 14:51
(Received via mailing list)
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?
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2008-12-22 19:51
(Received via mailing list)
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
This topic is locked and can not be replied to.