-
Hello, i'm trying to use a post commentary system with pagy! the behavior of pagination is the pages repeating the same posts on all the pages So, someone can if is possible to use pagy with polymorphic association? here is what i tried!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You should use The pagination of any AR relation boils down to calling You can check whether pagination will work on your particular AR relation by trying in the console: your_collection.offset(10).limit(10) Then check also whether the your_collection.count(:all) If that checks out then pagy should work with it out of the box. |
Beta Was this translation helpful? Give feedback.
You should use
pagy_array
only when you have an array of things that are already in memory. You don't use it for AR relations. Please, refer to thepagy_array
doc for details about the reasons.The pagination of any AR relation boils down to calling
offset
andlimit
on it, so getting a new paginated AR relation.You can check whether pagination will work on your particular AR relation by trying in the console:
Then check also whether the
count
is correct:If that checks out then pagy should work with it out of the box.