diff options
author | miloops <miloops@gmail.com> | 2008-08-30 21:13:53 -0300 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-08-30 17:39:30 -0700 |
commit | 6183e55f714b436335dc843528be7525c342d922 (patch) | |
tree | 8b8dce772a15b3be083daa5a258a622b1e861262 /activerecord/lib | |
parent | 367a55e1b8deb87e7388cb97b2ac8c28a0796c89 (diff) | |
download | rails-6183e55f714b436335dc843528be7525c342d922.tar.gz rails-6183e55f714b436335dc843528be7525c342d922.tar.bz2 rails-6183e55f714b436335dc843528be7525c342d922.zip |
Use reflection primary_key instead of id for when selecting association ids.
[#906 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 62cc414555..2470eb44b4 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1307,7 +1307,7 @@ module ActiveRecord if send(reflection.name).loaded? send(reflection.name).map(&:id) else - send(reflection.name).all(:select => "#{reflection.quoted_table_name}.id").map(&:id) + send(reflection.name).all(:select => "#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").map(&:id) end end end |