aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 6ab84df25b..0b92ba5caa 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -97,14 +97,14 @@ module ActiveRecord
#
# Article.published.new.published # => true
# Article.published.create.published # => true
- def scope(name, scope_options = {}, &block)
+ def scope(name, scope_options = {})
name = name.to_sym
valid_scope_name?(name)
- extension = Module.new(&block) if block_given?
+ extension = Module.new(&Proc.new) if block_given?
scopes[name] = lambda do |*args|
- options = scope_options.is_a?(Proc) ? scope_options.call(*args) : scope_options
+ options = scope_options.respond_to?(:call) ? scope_options.call(*args) : scope_options
relation = if options.is_a?(Hash)
scoped.apply_finder_options(options)