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:
parent
f6db31ec16
commit
fd68bd23b6
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue