rails model do something on destroy -
how can go writing method in model should called right before model destroyed?
for example want write loop update bunch of stuff in model b
when model a
destroyed
that's callbacks for, in case can use before_destroy callback such as:
class modela before_destroy :do_bunch_of_things def do_bunch_of_things ... end end
Comments
Post a Comment