aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-04-02 17:48:06 +0100
committerPratik Naik <pratiknaik@gmail.com>2010-04-02 18:57:45 +0100
commit0be31f85639cf2f536c558819ef3ee45ba7d83a3 (patch)
tree838029661daf09ad4bcb4619f1ac6d676a06a2e7 /activerecord/lib/active_record/named_scope.rb
parent1cd3d296f527d7109f6e875b3b9c698ff19f8173 (diff)
downloadrails-0be31f85639cf2f536c558819ef3ee45ba7d83a3.tar.gz
rails-0be31f85639cf2f536c558819ef3ee45ba7d83a3.tar.bz2
rails-0be31f85639cf2f536c558819ef3ee45ba7d83a3.zip
Scope#current_scoped_methods_when_defined is no longer needed
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb15
1 files changed, 2 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 3456332227..4203e36239 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -128,8 +128,6 @@ module ActiveRecord
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 @@ module ActiveRecord
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 @@ module ActiveRecord
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