From 6bd9fac1e301d57765073e1f7a17e46972428205 Mon Sep 17 00:00:00 2001 From: Glenn Vanderburg Date: Fri, 28 Jan 2011 18:16:44 -0600 Subject: Propagate association extensions to scopes called on the association. Signed-off-by: Santiago Pastorino --- activerecord/lib/active_record/associations/association_proxy.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 8e16246e80..84f868ec43 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -188,6 +188,9 @@ module ActiveRecord if select = select_value scope = scope.select(select) end + if Relation === scope + scope = scope.extending(*Array.wrap(@reflection.options[:extend])) + end scope.where(construct_owner_conditions) end -- cgit v1.2.3