Forum: Ruby on Rails Callbacks on has_many relation

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
6d1a17725da0c398a24ba3d489f1676a?d=identicon&s=25 Till Vollmer (Guest)
on 2006-05-01 00:01

Is there a way to implement a callback for somehting like before_add and
after_ad on a statement like this with a has_many relation?

x.children << Item.create(:title=>"test")

I want that x has a callback that is called when the item is added.

I found something in
but I can not override it.

Any hints?

6d1a17725da0c398a24ba3d489f1676a?d=identicon&s=25 Till Vollmer (Guest)
on 2006-05-02 00:28
Just in case someone is interested in the solution:

has_many :items,:after_add => :f1,:after_remove => :f2

This topic is locked and can not be replied to.