diff options
Diffstat (limited to 'activerecord/lib/active_record/scoping/named.rb')
-rw-r--r-- | activerecord/lib/active_record/scoping/named.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index 826b710e92..49cadb66d0 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -148,13 +148,9 @@ module ActiveRecord extension = Module.new(&block) if block singleton_class.send(:define_method, name) do |*args| - if body.respond_to?(:to_proc) - scope = all.scoping { instance_exec(*args, &body) } - else - # Body is given as an object instead of a block, so invoke call() - scope = all.scoping { body.call(*args) } - end + scope = all.scoping { body.call(*args) } scope = scope.extending(extension) if extension + scope || all end end |