aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-02-19 15:31:56 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2016-02-19 15:31:56 -0800
commit2df891dccdcfbdfb176c55297589712ac379f87d (patch)
tree0d2505faeaa910c2ef84ebcd70f45ab5d62bed99 /activerecord/lib/active_record/associations
parente0c6156c693efffd8009a116a96f7ff631e4db47 (diff)
downloadrails-2df891dccdcfbdfb176c55297589712ac379f87d.tar.gz
rails-2df891dccdcfbdfb176c55297589712ac379f87d.tar.bz2
rails-2df891dccdcfbdfb176c55297589712ac379f87d.zip
eliminate warnings about multiple primary keys on habtm join tables
habtm join tables commonly have two id columns and it's OK to make those two id columns a primary key. This commit eliminates the warnings for join tables that have this setup. ManageIQ/manageiq#6713
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb3
1 files changed, 3 insertions, 0 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 b888148841..5fbd79d118 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
@@ -76,6 +76,9 @@ module ActiveRecord::Associations::Builder # :nodoc:
left_model.retrieve_connection
end
+ def self.primary_key
+ false
+ end
}
join_model.name = "HABTM_#{association_name.to_s.camelize}"