diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-26 23:17:40 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-01-30 11:58:09 +0000 |
commit | 9db4c07e0bdf60982d08cb26035573995404eb98 (patch) | |
tree | fa0f8c475b6d45cbda4d9d7c242eeec459c41b68 /activerecord/lib | |
parent | 3fa61ccb9eed0f17cdef85470ae708b4b09a3c06 (diff) | |
download | rails-9db4c07e0bdf60982d08cb26035573995404eb98.tar.gz rails-9db4c07e0bdf60982d08cb26035573995404eb98.tar.bz2 rails-9db4c07e0bdf60982d08cb26035573995404eb98.zip |
Make use of helpers in AssociationReflection
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/through_association.rb | 8 |
1 files changed, 4 insertions, 4 deletions
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 << |