Back to Pagy

Paginator

docs/_includes/options/paginator.md

43.5.3921 B
Original Source

limit: 10 : Specifies the number of items per page (default: 20)

max_limit: 200 : Allow the client to request a :limit up to :max_limit. A higher requested :limit is silently capped.

IMPORTANT If falsey or zero, the client cannot request any :limit.

page: force_page : Set it only to force the current :page. (It is set automatically from the request param).

request: request || hash : Pagy tries to find the Rake::Request at self.request. Set it only when it's not directly available in your code (e.g., Hanami, standalone app, test,...). For example:

ruby
hash_request = { base_url: 'http://www.example.com',
                   path:     '/path',
                   params:   { 'param1' => 1234 }, # The string-keyed params hash from the request
                   cookie:   'xyz' }               # The 'pagy' cookie, only for keynav

{{ include "paginator-url" }}