diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-03-21 20:37:14 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-03-21 20:37:22 +0000 |
commit | fd68bd23b602ef2a7b038b66e787604df9192c6d (patch) | |
tree | 7914b8d668363f2c85bd9ad8a96ce1815544cd98 /activerecord/lib/active_record | |
parent | f6db31ec16e42ee7713029f7120f0b011d1ddc6c (diff) | |
download | rails-fd68bd23b602ef2a7b038b66e787604df9192c6d.tar.gz rails-fd68bd23b602ef2a7b038b66e787604df9192c6d.tar.bz2 rails-fd68bd23b602ef2a7b038b66e787604df9192c6d.zip |
Avoid obscure &Proc.new thing
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/scoping/named.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index 20c8e4b0f7..2f266eff79 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -171,8 +171,8 @@ module ActiveRecord # Article.published.featured.latest_article # Article.featured.titles - def scope(name, scope_options = {}) - extension = Module.new(&Proc.new) if block_given? + def scope(name, scope_options = {}, &block) + extension = Module.new(&block) if block singleton_class.send(:define_method, name) do |*args| options = scope_options.respond_to?(:call) ? unscoped { scope_options.call(*args) } : scope_options |