diff options
author | ecoologic <erikecoologic@gmail.com> | 2014-10-07 23:17:56 +1000 |
---|---|---|
committer | ecoologic <erikecoologic@gmail.com> | 2014-10-07 23:17:56 +1000 |
commit | 117f09c5d1eb600908001bb7b5ee353756e56456 (patch) | |
tree | 717d45020cf652840f90c09579692e30bf31237b /activerecord/lib/active_record/reflection.rb | |
parent | 8caf16a281260fedb0677c85047469e99c48da94 (diff) | |
parent | 75780373af9a3ddd4cc1bda3d4dbfe6121102b2e (diff) | |
download | rails-117f09c5d1eb600908001bb7b5ee353756e56456.tar.gz rails-117f09c5d1eb600908001bb7b5ee353756e56456.tar.bz2 rails-117f09c5d1eb600908001bb7b5ee353756e56456.zip |
Merge remote-tracking branch 'origin/master' into guides-template-inheritance
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index c0deb76a33..6b5a592ee5 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -728,8 +728,11 @@ module ActiveRecord through_scope_chain = through_reflection.scope_chain.map(&:dup) if options[:source_type] - through_scope_chain.first << - through_reflection.klass.where(foreign_type => options[:source_type]) + type = foreign_type + source_type = options[:source_type] + through_scope_chain.first << lambda { |object| + where(type => source_type) + } end # Recursively fill out the rest of the array from the through reflection |