Replies: 2 comments 3 replies
-
The Keyset pagination technique is not usable with frontend helpers like the The reasons are explained in details in the Pagy::Keyset documentation, which also shows you the differences between offset and keyset pagination. If you need frontend features and you have big tables, you can use the countless extra and/or the |
Beta Was this translation helpful? Give feedback.
-
Thank you for pointing me to the right direction. So far, I have only been using Using I found that that I can get a row estimate by running a query like this: Is there a way to integrate this number/estimate of total rows and make it work with Page? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have a table with 1,5M records and the classic
OFFSET
pagination performs extremely slow, so I am looking for a way to fix it. After some research, I found that the keyset pagination might be the way to go.I tried to implement
Pagy
- addedinclude Pagy::Backend
to the controller. Added the following to the controller action:Created the
PaginationHelper
:and finally, added the following to the view:
<%= pagy_nav(@pagy) %>
And this results into an error
undefined method `pages' for #<Pagy::Keyset::ActiveRecord:0x000000011545b7d8 @vars={:limit=>50, :page_param=>:page, :page=>nil}, @limit=50, @set=#<ActiveRecord::Relation [#<Car id: ...
I also noticed the following helpers in the documentation, but I am not sure how to properly use them.
How do I properly set up the keyset pagination?
Beta Was this translation helpful? Give feedback.
All reactions