has_and_belongs_to_many :developers, :after_add => :evaluate_velocity
...
end
end
It’s possible to stack callbacks by passing them as an array.
Possible callbacks are: before_add, after_add, before_remove and after_remove.
Should any of the before_add callbacks throw an exception, the object does not get added to the collection. Same with the before_remove callbacks, if an exception is thrown the object doesn’t get removed.
1 comment:
Very helpful, thank you!
Just to clarify for others, these callbacks belong in in the model on which you call update_attribute in the HABTM relationship, not for its partner model.
I found you through http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6fba72d612145ec0/d3429cdcb7269af8
Post a Comment