Today I noticed that calling object.collection.destroy_all leads to
calling association callbacks like ex. :before_remove but
object.destroy does not call those callbacks when configured
with :dependent => :destroy option.
You can find that hbtm uses collection.clear which under the hoods
calls collection.destroy_all however has_many uses the metod
configure_dependency_for_has_many to setup the hooks (
I think it could be a good thing to make has_many behave more like
hbtm and just use collection.destroy_all . This way also the
association callbacks would get called. Also probably the optimization
fix with counter_method could probably be move to the call in
destroy_all.