aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_proxy.rb
diff options
context:
space:
mode:
authorGlenn Vanderburg <glv@vanderburg.org>2011-01-28 18:16:44 -0600
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-01 12:38:58 -0200
commit6bd9fac1e301d57765073e1f7a17e46972428205 (patch)
tree8514c120608bbace9eb9230a064a0c1eebc6e1a7 /activerecord/lib/active_record/associations/association_proxy.rb
parent817e37013610c8e8866197594d5e408b4d5daec5 (diff)
downloadrails-6bd9fac1e301d57765073e1f7a17e46972428205.tar.gz
rails-6bd9fac1e301d57765073e1f7a17e46972428205.tar.bz2
rails-6bd9fac1e301d57765073e1f7a17e46972428205.zip
Propagate association extensions to scopes called on the association.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/lib/active_record/associations/association_proxy.rb')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb3
1 files changed, 3 insertions, 0 deletions
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