From 96e277c03b7e62e33858ea9e254c9ed88625778f Mon Sep 17 00:00:00 2001 From: eileencodes Date: Sun, 21 Dec 2014 17:51:16 -0500 Subject: Add `#all_includes` method to reflections `yield` instead of relying on checking if the reflection is equal to the `chain_head`. --- activerecord/lib/active_record/associations/association_scope.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations') 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 -- cgit v1.2.3