-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Hi there,
thanks for writing and maintaining this gem <3
We're using it for ActiveRecord pagination in several of our (non-Rails) Ruby apps, and I've recently come across the following behavior that seems somewhat inconsistent.
When called on an empty collection, #current_page returns 1, but #total_pages returns 0:
[1] pry(main)> collection = Item.where(author: author).page(1).per(10)
[]
[2] pry(main)> collection.current_page
1
[3] pry(main)> collection.total_pages
0
If the number of total pages is 0, I'd expect the current page to also be 0, otherwise it would come out looking like Page 1/0 to the user.
Is there a specific reason why current_page returns 1 in this case? If this looks like a bug to you, I'd be happy to look into it.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels