Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

page_entries_info using collection.size instead of collection.total_entries #284

Closed
chriswu000 opened this Issue · 3 comments

2 participants

@chriswu000

I had this error where I am setting the total entries when I call paginate, but page_entries_info was using collection.size instead of my manually set total_entries.

BTW, I discovered this when trying to work around the bug where using group results in a hash being displayed rather than the count being displayed.

It is line 140 of will_paginate/view_helpers.rb

Original:
will_paginate_translate keys, :count => collection.size, :model => model_name do |_, opts|

What I think it should be?
will_paginate_translate keys, :count => collection.total_entries, :model => model_name do |_, opts|

I apologize if I am incorrect or I am submitting this in a nonstandard way. This is the first time I've ever submitted an issue on github.

Love the gem, BTW!

-Chris

@mislav
Owner

That line is inside the condition that there are less than 2 total_pages. That means collection.size should be collection.total_entries. But since you're manually setting total_entries, you're getting unexpected results.

However I still don't understand your use case. Why are you using total_entries? What do you expect page_entries_info to show?

@mislav mislav closed this in 8738d80
@chriswu000
@mislav
Owner

It was a bug! Fixed in master, will release soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.