def has_and_belongs_to_many(association_id, options = {}, &extension)
reflection = create_has_and_belongs_to_many_reflection(association_id, options, &extension)
collection_accessor_methods(reflection, HasAndBelongsToManyAssociation)
old_method = "destroy_without_habtm_shim_for_#{reflection.name}"
class_eval "alias_method :\#{old_method}, :destroy_without_callbacks # alias_method :destroy_without_habtm_shim_for_posts, :destroy_without_callbacks\ndef destroy_without_callbacks # def destroy_without_callbacks\n\#{reflection.name}.clear # posts.clear\n\#{old_method} # destroy_without_habtm_shim_for_posts\nend # end\n" unless method_defined?(old_method)
add_association_callbacks(reflection.name, options)
end