Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WillFilter breaks after calls to ActiveRecord::Relation#page in apps using will_paginate #55

Open
plerohellec opened this issue May 9, 2014 · 0 comments

Comments

@plerohellec
Copy link

Kaminari adds the page method to ActiveRecord::Relation. Kaminari actually makes this method name configurable but WillFilter uses the 'page' method name and doesn't support a configuration option to change it. As a result, in applications using will_paginate, WillFilter::Filter#results blows up:

    def results
      @results ||= begin
        ...

        if custom_conditions?
          recs = process_custom_conditions(recs.all)
          recs = Kaminari.paginate_array(recs)
        end  

        recs = recs.page(page).per(per_page)
        recs.wf_filter = self
        recs
      end
    end

on the call to "per" as the will_paginate page method will have been called instead of the Kaminari one.

WillFilter should make the method name configurable the same way Kaminari daes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant