aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-12-21 17:51:16 -0500
committereileencodes <eileencodes@gmail.com>2015-01-02 17:15:31 -0500
commit96e277c03b7e62e33858ea9e254c9ed88625778f (patch)
tree423eb8217f4953a2e88d0e36a731b52bc476017f /activerecord/lib/active_record/associations
parent0408e212ca224bb25159f3e6db2a9c64cdea1200 (diff)
downloadrails-96e277c03b7e62e33858ea9e254c9ed88625778f.tar.gz
rails-96e277c03b7e62e33858ea9e254c9ed88625778f.tar.bz2
rails-96e277c03b7e62e33858ea9e254c9ed88625778f.zip
Add `#all_includes` method to reflections
`yield` instead of relying on checking if the reflection is equal to the `chain_head`.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/association_scope.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb
index 1f77a083aa..4fa227342f 100644
--- a/activerecord/lib/active_record/associations/association_scope.rb
+++ b/activerecord/lib/active_record/associations/association_scope.rb
@@ -121,6 +121,8 @@ module ActiveRecord
super(reflection)
@alias_name = alias_name
end
+
+ def all_includes; nil; end
end
def get_chain(refl, association, tracker)
@@ -161,7 +163,7 @@ module ActiveRecord
scope.merge! item.except(:where, :includes, :bind)
end
- if reflection == chain_head
+ reflection.all_includes do
scope.includes! item.includes_values
end