aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorTom Lea <contrib@tomlea.co.uk>2008-08-21 16:38:27 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-08-21 16:39:27 +0100
commit3724dafe71f4afb2ca9f4d7d2526b228aa6c05a3 (patch)
treebfe8bf6484940c610660e18ae2b68c0bee3984fe /activerecord
parent0d74e72e6de7b96e158950a449ea1ccce6f5b8d7 (diff)
downloadrails-3724dafe71f4afb2ca9f4d7d2526b228aa6c05a3.tar.gz
rails-3724dafe71f4afb2ca9f4d7d2526b228aa6c05a3.tar.bz2
rails-3724dafe71f4afb2ca9f4d7d2526b228aa6c05a3.zip
Fix incorrect signature for NamedScope#respond_to? [#852 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/named_scope.rb4
-rw-r--r--activerecord/test/cases/named_scope_test.rb5
2 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 26701548c2..c99c4beca9 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -140,8 +140,8 @@ module ActiveRecord
@found ? @found.empty? : count.zero?
end
- def respond_to?(method)
- super || @proxy_scope.respond_to?(method)
+ def respond_to?(method, include_private = false)
+ super || @proxy_scope.respond_to?(method, include_private)
end
def any?
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index db31ddb293..6f6ea1cbe9 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -52,6 +52,11 @@ class NamedScopeTest < ActiveRecord::TestCase
assert Topic.approved.respond_to?(:length)
end
+ def test_respond_to_respects_include_private_parameter
+ assert !Topic.approved.respond_to?(:load_found)
+ assert Topic.approved.respond_to?(:load_found, true)
+ end
+
def test_subclasses_inherit_scopes
assert Topic.scopes.include?(:base)