Options Hierarchy


Pagy implements a hierarchical options system working at three different levels, regardless where the option gets consumed.

Levels

  • For example Pagy::OPTIONS[:limit] = 10 set in the pagy.rb initializer.
  • The Pagy::OPTIONS are inherited by all paginators and helpers.
  • IMPORTANT: Freeze it after you are done in the initializer, for good safe practice.
  • For example pagy(paginator, collection, **options).
  • The options passed to a paginator override the Pagy::OPTIONS for that instance.
  • They are also inherited by all the helpers used by the instance.
  • For example @pagy.series_nav(**options).
  • The options passed to a helper override the options affecting its output.
  • The options consumed upstream are not affected.