Skip to content
This repository

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

Closed
chriswu000 opened this Issue · 3 comments

2 participants

Christopher Wu Mislav Marohnić
Christopher Wu

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 Marohnić
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?

Christopher Wu
Mislav Marohnić
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.