Displaying 1 result from an estimated 1 matches for "after_add_child".
2006 Jun 23
0
adding action after a belongs_to assignment
...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'', :foreign_key =>
''parent_id'',
:after_add => :after_add_child, :before_remove =>
:before_remove_child
belongs_to :parent, :class_name => ''Company'', :foreign_key =>
''parent_id''
# something similar to :after_add above?
end
--
Endy
--
Posted via http://www.ruby-forum.com/.