Wrong display for count of rows when using group by and there is only one page #278

Closed
prekageo opened this Issue Nov 28, 2012 · 0 comments

2 participants

@prekageo

Check here: https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/view_helpers.rb#L140
and here:
https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/view_helpers.rb#L151

In the first case you use collection.size and in the second case you use collection.total_entries. The latter one has the workaround for the "group by case", while the former does not. I guess if you use total_entries in both situations everything will be fine. Until then, the workaround in applications would be to do:

collection = Table.paginate(...).all

That way ActiveRecord's size does not issue a select count. Instead it counts the rows fetched.

@mislav mislav added a commit that closed this issue Jan 10, 2013
@mislav use `total_entries` in page_entries_info() consistently
Fixes #278, fixes #284, fixes #207
8738d80
@mislav mislav closed this in 8738d80 Jan 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment