aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-19 17:12:45 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-19 17:29:25 -0700
commit56be4c897ae52d73583c51dec155e6161e3dc900 (patch)
treece775522d0eb759e03367db53c9973427c066759
parent17d196a18eb2b106321be493616adb138e3c71cf (diff)
downloadrails-56be4c897ae52d73583c51dec155e6161e3dc900.tar.gz
rails-56be4c897ae52d73583c51dec155e6161e3dc900.tar.bz2
rails-56be4c897ae52d73583c51dec155e6161e3dc900.zip
avoid creating the proc object if possible
-rw-r--r--activerecord/lib/active_record/named_scope.rb4
1 files changed, 2 insertions, 2 deletions
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