Skip to content

Commit

Permalink
Fix incorrect signature for NamedScope#respond_to? [#852 state:resolved]
Browse files Browse the repository at this point in the history
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
tomlea authored and tarmo committed Aug 24, 2008
1 parent 2092f26 commit 7688678
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/named_scope.rb
Expand Up @@ -140,8 +140,8 @@ def empty?
@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

protected
Expand Down
5 changes: 5 additions & 0 deletions activerecord/test/cases/named_scope_test.rb
Expand Up @@ -52,6 +52,11 @@ def test_scope_should_respond_to_own_methods_and_methods_of_the_proxy
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)

Expand Down

0 comments on commit 7688678

Please sign in to comment.