mercredi 30 septembre 2015

Rails 3 before_destroy triggered twice

in a Rails 3 application there are two models assinged to each other by belongs_to and has_one. On both sides there is :depended => :destroy configured for this association. now I had to add a :before_destroy callback in one of these models. the problem is now that this callback is triggered twice when an entity which includes this callback is destroyed. When I remove :depended => :destroy in the other model, it's triggered only once. So it seems this i causing the problem.

is there an elegant way to fix this ?

Aucun commentaire:

Enregistrer un commentaire