Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

method_missing and respond_to? bug #17

enriquez opened this Issue Nov 19, 2009 · 4 comments


None yet
2 participants

enriquez commented Nov 19, 2009

Since will_paginate's method_missing takes control over any method that starts with the word "paginate", any custom methods that start with that word will not be found with respond_to?

A work around for now is to rename the method to not use the word "paginate" in the front.



mislav commented Dec 16, 2009

method_missing only handles calls to nonexistent methods that start with "paginate". it will never handle calls to methods that actually exist.

I'm not sure what you want here, and what needs to be fixed. In the test you wrote you just defined a sample method and checked if it's defined. This confuses me and I still don't see how this relates to pagination or ActiveRecord at all.


enriquez commented Dec 16, 2009

The problem is that will_paginate breaks respond_to? for the sample method.


class Topic < ActiveRecord::Base
  def self.paginate_by_definition_in_class; end

Topic.respond_to?(:paginate_by_definition_in_class) # => false (should be true)

Since the sample method starts with the word "paginate", will_paginate's respond_to? method never checks for any existing methods that start with the word "paginate". Therefore, it unexpectedly returns false because the plugin thinks that "definition_in_class" is a dynamic finder.


mislav commented Dec 16, 2009

Oh. I'm very sorry. I didn't read good enough. I thought you said method calls are broken, while it's just respond_to? in question.

Gonna pull your fix next time I'm working on wp. Thanks


mislav commented Sep 9, 2010

Pulled! Thanks

@egiblin egiblin pushed a commit to egiblin/will_paginate that referenced this issue Feb 22, 2017

@AlexMerritt AlexMerritt Merge pull request #17 from jd2rogers2/master
listing ctrl; index, show, edit, update routes and views

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment