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

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -