From 9db4c07e0bdf60982d08cb26035573995404eb98 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Wed, 26 Jan 2011 23:17:40 +0000 Subject: Make use of helpers in AssociationReflection --- .../lib/active_record/associations/through_association.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index be1fc79846..c840a16160 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -47,9 +47,9 @@ module ActiveRecord conditions = [] if @reflection.source_reflection.macro == :belongs_to - reflection_primary_key = @reflection.source_reflection.options[:primary_key] || - @reflection.klass.primary_key + reflection_primary_key = @reflection.source_reflection.association_primary_key source_primary_key = @reflection.source_reflection.foreign_key + if @reflection.options[:source_type] column = @reflection.source_reflection.foreign_type conditions << @@ -57,8 +57,8 @@ module ActiveRecord end else reflection_primary_key = @reflection.source_reflection.foreign_key - source_primary_key = @reflection.source_reflection.options[:primary_key] || - @reflection.through_reflection.klass.primary_key + source_primary_key = @reflection.source_reflection.active_record_primary_key + if @reflection.source_reflection.options[:as] column = "#{@reflection.source_reflection.options[:as]}_type" conditions << -- cgit v1.2.3