Skip to content

Commit

Permalink
ensure respond_to? works as expected when a method happens to begin w…
Browse files Browse the repository at this point in the history
…ith the word 'paginate'
  • Loading branch information
enriquez committed Nov 9, 2009
1 parent 839d821 commit 26e5cf7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/will_paginate/finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def respond_to?(method, include_priv = false) #:nodoc:
when :paginate, :paginate_by_sql
true
else
super(method.to_s.sub(/^paginate/, 'find'), include_priv)
super || super(method.to_s.sub(/^paginate/, 'find'), include_priv)
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/finder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class FinderTest < ActiveRecordTestCase
fixtures :topics, :replies, :users, :projects, :developers_projects

def test_new_methods_presence
assert_respond_to_all Topic, %w(per_page paginate paginate_by_sql)
assert_respond_to_all Topic, %w(per_page paginate paginate_by_sql paginate_by_definition_in_class)
end

def test_simple_paginate
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ class Topic < ActiveRecord::Base
named_scope :with_replies_starting_with, lambda { |text|
{ :conditions => "replies.content LIKE '#{text}%' ", :include => :replies }
}

def self.paginate_by_definition_in_class; end
end

0 comments on commit 26e5cf7

Please sign in to comment.