Permalink
Browse files

ensure respond_to? works as expected when a method happens to begin w…

…ith the word 'paginate'
  • Loading branch information...
1 parent 060e61d commit 9c5c2d924f12dac9b87b837c70e5c8700d6b2d55 @enriquez enriquez committed with mislav Nov 9, 2009
Showing with 4 additions and 2 deletions.
  1. +1 −1 lib/will_paginate/finder.rb
  2. +1 −1 test/finder_test.rb
  3. +2 −0 test/fixtures/topic.rb
@@ -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
View
@@ -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
View
@@ -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 9c5c2d9

Please sign in to comment.