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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -