1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Avoid obscure &Proc.new thing

This commit is contained in:
Jon Leighton 2012-03-21 20:37:14 +00:00
parent f6db31ec16
commit fd68bd23b6

View file

@ -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