Permalink
Browse files

Scope#current_scoped_methods_when_defined is no longer needed

  • Loading branch information...
1 parent 1cd3d29 commit 0be31f85639cf2f536c558819ef3ee45ba7d83a3 @lifo lifo committed Apr 2, 2010
Showing with 2 additions and 13 deletions.
  1. +2 −13 activerecord/lib/active_record/named_scope.rb
@@ -128,8 +128,6 @@ def named_scope(*args, &block)
end
class Scope < Relation
- attr_accessor :current_scoped_methods_when_defined
-
delegate :scopes, :with_scope, :with_exclusive_scope, :scoped_methods, :scoped, :to => :klass
def self.init(klass, options, &block)
@@ -141,10 +139,7 @@ def self.init(klass, options, &block)
options ? klass.scoped.merge(options) : klass.scoped
end
- relation = relation.merge(scope)
-
- relation.current_scoped_methods_when_defined = klass.send(:current_scoped_methods)
- relation
+ relation.merge(scope)
end
def first(*args)
@@ -178,13 +173,7 @@ def ==(other)
def method_missing(method, *args, &block)
if klass.respond_to?(method)
- with_scope(self) do
- if current_scoped_methods_when_defined && !scoped_methods.include?(current_scoped_methods_when_defined) && !scopes.include?(method)
- with_scope(current_scoped_methods_when_defined) { klass.send(method, *args, &block) }
- else
- klass.send(method, *args, &block)
- end
- end
+ with_scope(self) { klass.send(method, *args, &block) }
else
super
end

0 comments on commit 0be31f8

Please sign in to comment.