Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

will_paginate doubles the number of pages that are actually there.

#31

I am trying to use will_paginate and am running into an issue

whereby the will_paginate helper displays double the number of pages that there physically are. I think it has to do with the fact that we're using quite a bit of custom finder code but cannot verify this as yet.

Is there a way to adjust the way total_pages is calculated? Perhaps using :count => parameter? I couldn't find how to use :count => documented anywhere to pursue this direction.

Reported by Wayne Seguin · June 14th, 2007 @ 03:43 AM

State: invalid
Milestone: none
Assigned to: Mislav Mislav

Activity

  1. Mislav
    Mislav
    • State changed from new to invalid

    If you don't will_paginate to count your records, simply use the "total_entries" option. The value should be an integer and its presence makes the paginating finders skip the counting logic.

    Total page number is then being calculated like this:

    @total_pages   = (@total_entries / @per_page.to_f).ceil
    

    June 14th, 2007 @ 03:43 AM

  2. Chris Wanstrath
    Chris Wanstrath

    This may or may not be fixed with changeset 258. Update the plugin and try again.

    June 14th, 2007 @ 03:43 AM

  3. Wayne Seguin
    Wayne Seguin

    It turns out that passing:

    :count => { :select => "distinct o.id" }

    fixed the issue for us.

    Thanks for the response!

    June 14th, 2007 @ 03:43 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.