aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorjvoorhis <jvoorhis@jeremy-voorhiss-macbook.local>2009-03-06 16:47:50 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-06 16:47:50 +0000
commit6a13376525f34a00e013fc3a6022838329dfe856 (patch)
treeb34b909463c39f25de97cf8351ab8452ddfb9d84 /activerecord/lib/active_record
parentc67d25e3c4e636d7c94909a7398231a634accf46 (diff)
downloadrails-6a13376525f34a00e013fc3a6022838329dfe856.tar.gz
rails-6a13376525f34a00e013fc3a6022838329dfe856.tar.bz2
rails-6a13376525f34a00e013fc3a6022838329dfe856.zip
Methods invoked within named scope Procs should respect the scope stack. [#1267 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/named_scope.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 8a7449f95b..43411dfb55 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -89,7 +89,12 @@ module ActiveRecord
when Hash
options
when Proc
- options.call(*args)
+ case parent_scope
+ when Scope
+ with_scope(:find => parent_scope.proxy_options) { options.call(*args) }
+ else
+ options.call(*args)
+ end
end, &block)
end
(class << self; self end).instance_eval do