    # File lib/active_record/associations.rb, line 850
          def has_and_belongs_to_many(association_id, options = {}, &extension)
            reflection = create_has_and_belongs_to_many_reflection(association_id, options, &extension)

            add_multiple_associated_save_callbacks(reflection.name)
            collection_accessor_methods(reflection, HasAndBelongsToManyAssociation)

            # Don't use a before_destroy callback since users' before_destroy
            # callbacks will be executed after the association is wiped out.
            old_method = "destroy_without_habtm_shim_for_#{reflection.name}"
            class_eval "alias_method :\#{old_method}, :destroy_without_callbacks\ndef destroy_without_callbacks\n\#{reflection.name}.clear\n\#{old_method}\nend\n"

            add_association_callbacks(reflection.name, options)

            # deprecated api
            deprecated_collection_count_method(reflection.name)
            deprecated_add_association_relation(reflection.name)
            deprecated_remove_association_relation(reflection.name)
            deprecated_has_collection_method(reflection.name)
          end