Skip to content
Browse files

Remove unnecessary argument for creating scopes

  • Loading branch information...
1 parent 47c99f9 commit 684e4d39d60d87273ea74f9a076b3ea308fc2ffe @lifo lifo committed Apr 3, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/named_scope.rb
View
8 activerecord/lib/active_record/named_scope.rb
@@ -107,7 +107,7 @@ def scope(name, options = {}, &block)
"Overwriting existing method #{self.name}.#{name}."
end
- scopes[name] = lambda do |parent_scope, *args|
+ scopes[name] = lambda do |*args|
scope_options = case options
when Hash, Relation
options
@@ -116,17 +116,17 @@ def scope(name, options = {}, &block)
end
relation = if scope_options.is_a?(Hash)
- parent_scope.scoped.apply_finder_options(scope_options)
+ scoped.apply_finder_options(scope_options)
else
- scope_options ? parent_scope.scoped.merge(scope_options) : parent_scope.scoped
+ scope_options ? scoped.merge(scope_options) : scoped
end
block_given? ? relation.extending(Module.new(&block)) : relation
end
singleton_class.instance_eval do
define_method name do |*args|
- scopes[name].call(self, *args)
+ scopes[name].call(*args)
end
end
end

0 comments on commit 684e4d3

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