diff options
author | Denis Odorcic <denis.odorcic@gmail.com> | 2010-10-21 00:23:05 -0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-30 11:24:36 -0700 |
commit | cc9742920ccaf8e985fbe5239edb966949eb91c3 (patch) | |
tree | ae262c6822264aa10ca6a4599471aeb70ecd2e67 /activerecord/lib | |
parent | 67a3a702951dae905b6270d652dbd14853b01c26 (diff) | |
download | rails-cc9742920ccaf8e985fbe5239edb966949eb91c3.tar.gz rails-cc9742920ccaf8e985fbe5239edb966949eb91c3.tar.bz2 rails-cc9742920ccaf8e985fbe5239edb966949eb91c3.zip |
Convert :primary_key in association to a string before comparing to column names, so that for example :primary_key => :another_pk works as well [#5605 state:resolved]
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/association_preload.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/association_preload.rb b/activerecord/lib/active_record/association_preload.rb index c2a71487dc..911a5155fd 100644 --- a/activerecord/lib/active_record/association_preload.rb +++ b/activerecord/lib/active_record/association_preload.rb @@ -320,7 +320,7 @@ module ActiveRecord klass = klass_name.constantize table_name = klass.quoted_table_name - primary_key = reflection.options[:primary_key] || klass.primary_key + primary_key = (reflection.options[:primary_key] || klass.primary_key).to_s column_type = klass.columns.detect{|c| c.name == primary_key}.type ids = _id_map.keys.map do |id| |