Equivalent of Pagy.new in v43 #833
-
|
I'm using pagy in a Sinatra environment with Elasticsearch in a custom, non-Rails way and just upgraded to v43. Most migrations worked really well thanks to the equivalents posted in the migration README. The one exception is the dozen or so instances of Pagy.new I used for custom handling of total counts, paging, and limits. For example, I have v9 pagy code like this: ...where results is that returned from my elasticsearch index response using symbolized keys and with the paging activities happening immediately upstream from these lines of code so that I'm merely passing in their values to Pagy.new. I'm very close to duplicating this same behaviour in v43 by trying this: Note that I have to force the page = 1 here because paging actually happens in my immediate upstream code. This is not entirely desirable because of course the rendered view has its page 1 permanently chosen via the How might I get a functioning replacement for Pagy.new behaviour in v43? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
Aha! I finally found the answer to my own question: |
Beta Was this translation helpful? Give feedback.
-
|
Why you don't just do: @pagy = pagy(:elasticsearch_rails, results)And BTW, in your example you should pass |
Beta Was this translation helpful? Give feedback.
Aha! I finally found the answer to my own question: