Skip to content
Browse files

no need for lvar

  • Loading branch information...
1 parent d99c790 commit 7c1275a005f8ed1820a93069c90d515b2f7a8e1a @jonleighton jonleighton committed Mar 21, 2012
Showing with 1 addition and 3 deletions.
  1. +1 −3 activerecord/lib/active_record/scoping/named.rb
View
4 activerecord/lib/active_record/scoping/named.rb
@@ -176,16 +176,14 @@ def scope(name, scope_options = {})
valid_scope_name?(name)
extension = Module.new(&Proc.new) if block_given?
- scope_proc = lambda do |*args|
+ singleton_class.send(:redefine_method, name) do |*args|
options = scope_options.respond_to?(:call) ? unscoped { scope_options.call(*args) } : scope_options
options = scoped.apply_finder_options(options) if options.is_a?(Hash)
relation = scoped.merge(options)
extension ? relation.extending(extension) : relation
end
-
- singleton_class.send(:redefine_method, name, &scope_proc)
end
protected

0 comments on commit 7c1275a

Please sign in to comment.
Something went wrong with that request. Please try again.