diff options
author | Ernie Miller <ernie@metautonomo.us> | 2010-03-29 16:38:44 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-29 15:24:27 -0700 |
commit | 63026541b209cc11ffd74cf3ca04b89d1e437737 (patch) | |
tree | 6f274f2d13577e64f03160fc788b705c9893f85e /activerecord/lib/active_record/associations.rb | |
parent | a509b0b18fd02d1d712248ce94e1d36750d58565 (diff) | |
download | rails-63026541b209cc11ffd74cf3ca04b89d1e437737.tar.gz rails-63026541b209cc11ffd74cf3ca04b89d1e437737.tar.bz2 rails-63026541b209cc11ffd74cf3ca04b89d1e437737.zip |
Fix honoring :primary_key option when joining or eager loading a belongs_to association
[#765 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-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 ee87cb9b41..7406daf837 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -2031,7 +2031,7 @@ module ActiveRecord [aliased_table[foreign_key].eq(parent_table[reflection.options[:primary_key] || parent.primary_key])] end when :belongs_to - [aliased_table[reflection.klass.primary_key].eq(parent_table[options[:foreign_key] || reflection.primary_key_name])] + [aliased_table[options[:primary_key] || reflection.klass.primary_key].eq(parent_table[options[:foreign_key] || reflection.primary_key_name])] end unless klass.descends_from_active_record? |