aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
diff options
context:
space:
mode:
authorecoologic <erikecoologic@gmail.com>2014-10-07 23:17:56 +1000
committerecoologic <erikecoologic@gmail.com>2014-10-07 23:17:56 +1000
commit117f09c5d1eb600908001bb7b5ee353756e56456 (patch)
tree717d45020cf652840f90c09579692e30bf31237b /activerecord/lib/active_record/reflection.rb
parent8caf16a281260fedb0677c85047469e99c48da94 (diff)
parent75780373af9a3ddd4cc1bda3d4dbfe6121102b2e (diff)
downloadrails-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.rb7
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