You may be able to use the callback after_committo do something after the entire transaction has passed through the database. It depends on the version of Rails you are using (2.3.x versus 3.xx), but essentially looks something like this:
class ModelObserver < ActiveRecord::Observer
def after_commit(instance)
do_something if instance.destroyed?
end
end
You can read some documentation on the Rails 3 callback after_commit here . If your version of Rails does not have a hook after_commit, you can try this stone , which will provide you with functionality.
source
share