diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-02 15:49:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-02 15:49:36 -0700 |
commit | 8e4afa4eb1bd64cdfa3689df7a06e5148e063364 (patch) | |
tree | 0e79f8047c72c2ea5bf4b46ab5118bc388ba4484 /activerecord/lib/active_record/associations/builder | |
parent | dca2fb368096735d18ea5b881e08816f7d552044 (diff) | |
download | rails-8e4afa4eb1bd64cdfa3689df7a06e5148e063364.tar.gz rails-8e4afa4eb1bd64cdfa3689df7a06e5148e063364.tar.bz2 rails-8e4afa4eb1bd64cdfa3689df7a06e5148e063364.zip |
repurpose the HABTM builder class
Diffstat (limited to 'activerecord/lib/active_record/associations/builder')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb | 25 |
1 files changed, 1 insertions, 24 deletions
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 |