From 56be4c897ae52d73583c51dec155e6161e3dc900 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 19 Oct 2010 17:12:45 -0700 Subject: avoid creating the proc object if possible --- activerecord/lib/active_record/named_scope.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb index 6ab84df25b..b767a2b4a8 100644 --- a/activerecord/lib/active_record/named_scope.rb +++ b/activerecord/lib/active_record/named_scope.rb @@ -97,11 +97,11 @@ 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 -- cgit v1.2.3