diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-10-19 14:14:06 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2010-10-19 14:14:06 +0100 |
commit | 01838636c6136d9a649ace71db61bb7990f9bd82 (patch) | |
tree | 2f307e4dd6843588ab19f7d41615a04465560fff /activerecord/lib/active_record/associations/through_association_scope.rb | |
parent | 596cc3b2329a9cc4a30c95c157ce36b2d08975df (diff) | |
download | rails-01838636c6136d9a649ace71db61bb7990f9bd82.tar.gz rails-01838636c6136d9a649ace71db61bb7990f9bd82.tar.bz2 rails-01838636c6136d9a649ace71db61bb7990f9bd82.zip |
Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many
Diffstat (limited to 'activerecord/lib/active_record/associations/through_association_scope.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/through_association_scope.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/through_association_scope.rb b/activerecord/lib/active_record/associations/through_association_scope.rb index 86ceb1a204..2b2229f01f 100644 --- a/activerecord/lib/active_record/associations/through_association_scope.rb +++ b/activerecord/lib/active_record/associations/through_association_scope.rb @@ -108,7 +108,7 @@ module ActiveRecord when :belongs_to joins << inner_join_sql( right_table_and_alias, - table_aliases[left], left.klass.primary_key, + table_aliases[left], left.source_reflection.association_primary_key, table_aliases[right], left.source_reflection.primary_key_name, source_type_conditions(left), reflection_conditions(right_index) @@ -124,7 +124,7 @@ module ActiveRecord joins << inner_join_sql( right_table_and_alias, table_aliases[left], left.source_reflection.primary_key_name, - right_table, right.klass.primary_key, + right_table, left.source_reflection.active_record_primary_key, polymorphic_conditions(left, left.source_reflection), reflection_conditions(right_index) ) |