aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/association_scope.rb4
-rw-r--r--activerecord/lib/active_record/reflection.rb2
2 files changed, 5 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
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index 111911b575..25fda8f110 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -970,6 +970,8 @@ module ActiveRecord
def alias_name
Arel::Table.new(table_name)
end
+
+ def all_includes; yield; end
end
end
end