Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ith the word 'paginate'
  • Loading branch information...
commit 9c5c2d924f12dac9b87b837c70e5c8700d6b2d55 1 parent 060e61d
@enriquez enriquez authored mislav committed
View
2  lib/will_paginate/finder.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
2  test/finder_test.rb
@@ -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
2  test/fixtures/topic.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.