public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Use reflection primary_key instead of id for when selecting association ids.

[#906 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
miloops (author)
Sat Aug 30 17:13:53 -0700 2008
jeremy (committer)
Sat Aug 30 17:39:30 -0700 2008
commit  6183e55f714b436335dc843528be7525c342d922
tree    8b8dce772a15b3be083daa5a258a622b1e861262
parent  367a55e1b8deb87e7388cb97b2ac8c28a0796c89
...
1307
1308
1309
1310
 
1311
1312
1313
...
1307
1308
1309
 
1310
1311
1312
1313
0
@@ -1307,7 +1307,7 @@ module ActiveRecord
0
             if send(reflection.name).loaded?
0
               send(reflection.name).map(&:id)
0
             else
0
-              send(reflection.name).all(:select => "#{reflection.quoted_table_name}.id").map(&:id)
0
+              send(reflection.name).all(:select => "#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").map(&:id)
0
             end
0
           end
0
         end

Comments