From 8e4afa4eb1bd64cdfa3689df7a06e5148e063364 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 2 Oct 2013 15:49:36 -0700 Subject: repurpose the HABTM builder class --- .../builder/has_and_belongs_to_many.rb | 25 +--------------------- 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'activerecord/lib/active_record/associations/builder') diff --git a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb index 8df7e7857f..b4537c5564 100644 --- a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb @@ -1,5 +1,5 @@ module ActiveRecord::Associations::Builder - class HABTM + class HasAndBelongsToMany # :nodoc: class JoinTableResolver KnownTable = Struct.new :join_table @@ -118,27 +118,4 @@ module ActiveRecord::Associations::Builder rhs_options end end - - class HasAndBelongsToMany < CollectionAssociation #:nodoc: - def macro - :has_and_belongs_to_many - end - - def valid_options - super + [:join_table, :association_foreign_key] - end - - def self.define_callbacks(model, reflection) - super - name = reflection.name - model.send(:include, Module.new { - class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def destroy_associations - association(:#{name}).delete_all - super - end - RUBY - }) - end - end end -- cgit v1.2.3