aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-06-28 12:36:42 -0400
committerGitHub <noreply@github.com>2017-06-28 12:36:42 -0400
commit2f36c9889a3696f4e8282b56cf344faa75cee334 (patch)
tree1d337e13bb1ba4ae4d2f7af36cbf37ea4a111e8f /activerecord
parent5241b265126ac9ecadf1414feaf4c42ceb056432 (diff)
parentbf3f2010003326a42d86a88425e3c66242c2f2f1 (diff)
downloadrails-2f36c9889a3696f4e8282b56cf344faa75cee334.tar.gz
rails-2f36c9889a3696f4e8282b56cf344faa75cee334.tar.bz2
rails-2f36c9889a3696f4e8282b56cf344faa75cee334.zip
Merge pull request #29604 from kamipo/fix_ids_reader_to_respect_case_sensitive_pk
Fix `ids_reader` to respect case sensitive primary key
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb5
-rw-r--r--activerecord/test/schema/schema.rb2
2 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 0cb17b47e8..583ee11907 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -44,10 +44,7 @@ module ActiveRecord
if loaded?
target.pluck(reflection.association_primary_key)
else
- @association_ids ||= (
- column = "#{reflection.quoted_table_name}.#{reflection.association_primary_key}"
- scope.pluck(column)
- )
+ @association_ids ||= scope.pluck(reflection.association_primary_key)
end
end
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index d7ceb6d4ef..f534e9c00e 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -107,7 +107,7 @@ ActiveRecord::Schema.define do
t.boolean :has_fun, null: false, default: false
end
- create_table :bulbs, force: true do |t|
+ create_table :bulbs, primary_key: "ID", force: true do |t|
t.integer :car_id
t.string :name
t.boolean :frickinawesome, default: false