diff options
author | Mohammad El-Abid <mohammad.elabid@gmail.com> | 2011-05-26 00:54:51 -0400 |
---|---|---|
committer | Mohammad El-Abid <mohammad.elabid@gmail.com> | 2011-05-26 00:54:51 -0400 |
commit | ec44763f03b49e8c6e3bff71772ba32863a01306 (patch) | |
tree | c48304d17a201ba3c5d4b86af9caf08cebe669a6 /activerecord/lib/active_record | |
parent | bf9272b9d42656efc2fd935c6a4108c8e0f306d0 (diff) | |
download | rails-ec44763f03b49e8c6e3bff71772ba32863a01306.tar.gz rails-ec44763f03b49e8c6e3bff71772ba32863a01306.tar.bz2 rails-ec44763f03b49e8c6e3bff71772ba32863a01306.zip |
Removes the restriction on primary key when joining in a habtm && test that it was properly removed
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb | 4 |
2 files changed, 0 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 1c7209e64e..a0a1ff23db 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -76,12 +76,6 @@ module ActiveRecord end end - class HasAndBelongsToManyAssociationWithPrimaryKeyError < ActiveRecordError #:nodoc: - def initialize(reflection) - super("Primary key is not allowed in a has_and_belongs_to_many join table (#{reflection.options[:join_table]}).") - end - end - class HasAndBelongsToManyAssociationForeignKeyNeeded < ActiveRecordError #:nodoc: def initialize(reflection) super("Cannot create self referential has_and_belongs_to_many association on '#{reflection.class_name rescue nil}##{reflection.name rescue nil}'. :association_foreign_key cannot be the same as the :foreign_key.") 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 4b48757da7..d7632b2ea9 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 @@ -39,10 +39,6 @@ module ActiveRecord::Associations::Builder model.send(:undecorated_table_name, model.to_s), model.send(:undecorated_table_name, reflection.class_name) ) - - if model.connection.supports_primary_key? && (model.connection.primary_key(reflection.options[:join_table]) rescue false) - raise ActiveRecord::HasAndBelongsToManyAssociationWithPrimaryKeyError.new(reflection) - end end # Generates a join table name from two provided table names. |