search for: parent_before_mod

Displaying 1 result from an estimated 1 matches for "parent_before_mod".

2006 Jun 23
0
adding action after a belongs_to assignment
What is the best way to add action after a belongs_to assignment? (Just like ''after_add'' in has_many assignment). I see that there is no callbacks for belongs_to. I have tried overriding parent= : alias :parent_before_mod= :parent= def parent=(the_parent) parent_before_mod = the_parent if save # my actions here end end but when I tried to assign parent, parent_id was not changed. Can someone help? class Company < ActiveRecord::Base has_many :children, :class_name => ''Company'',...