Browse files

primary_key is returned as either string or symbol, in columns loop m…

…ap everything to string
  • Loading branch information...
1 parent 117cad8 commit 2deaa2566f34ad3b53a90f17eab66317194d4e9c @bluetrans-deploy bluetrans-deploy committed with tenderlove Jan 10, 2011
Showing with 1 addition and 2 deletions.
  1. +1 −2 activerecord/lib/active_record/association_preload.rb
View
3 activerecord/lib/active_record/association_preload.rb
@@ -341,8 +341,7 @@ def preload_belongs_to_association(records, reflection, preload_options={})
table_name = klass.quoted_table_name
primary_key = reflection.options[:primary_key] || klass.primary_key
- column_type = klass.columns.detect{|c| c.name == primary_key}.class
-
+ column_type = klass.columns.detect{|c| c.name == primary_key.to_s}.class
ids = id_map.keys.map do |id|
if column_type == :integer
id.to_i

0 comments on commit 2deaa25

Please sign in to comment.