From 4debc86bd329d31360272ed15459cde3b9af3a10 Mon Sep 17 00:00:00 2001 From: Lauro Caetano Date: Wed, 23 Apr 2014 23:51:00 -0300 Subject: Fix polymorphic eager load with foreign_key as String. The foreign_key could be `String` and just doing `owners_map[owner_key]` could return `nil`. To prevent this bug, we should `to_s` both keys if their types are different. Fixes #14734. --- activerecord/test/schema/schema.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/test/schema/schema.rb') diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 9e511af3bd..67ba358843 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -187,6 +187,9 @@ ActiveRecord::Schema.define do t.integer :taggings_count, default: 0 t.integer :children_count, default: 0 t.integer :parent_id + t.references :author, polymorphic: true + t.string :resource_id + t.string :resource_type end create_table :companies, force: true do |t| -- cgit v1.2.3