#
#
Quick Start
#
1. Install
To prevent unexpected breaking changes, see RubyGem Specifiers:
Gemfile
gem 'pagy', '~> 10.0' # omit the patch version
#
• Play with it directly...
- ...in the Browser
- Run
pagy demo
in your terminal, and visit http://0.0.0.0:8000
- Run
- ...in IRB
- Include the Pagy::Console
#
2. Use
Include the
pagy
method where you are going to use it (usually ApplicationController):include Pagy::Method
Use it to paginate any collection with any technique:
@pagy, @records = pagy(:offset, Product.some_scope, **options) # :offset paginator @pagy, @records = pagy(:keyset, Product.some_scope, **options) # :keyset paginator @pagy, @records = pagy(...)
See all the available paginators
Render navigator tags and other helpers with the
@pagy
instance methods:<%# Render navigation bar helpers with various types and styles %> <%== @pagy.nav_tag %> <%== @pagy.nav_js_tag(:bootstrap) %> <%== @pagy.combo_nav_js_tag(:bulma) %> <%== @pagy.info_tag %>
See all the available @pagy methods
#
3. Configure global options and special features
#
Pick a stylesheet or a CSS framework
- For native pagy helpers (used also with tailwind), you can integrate the Stylesheet into your app.
- For
:bootstrap
and:bulma
styles, no additional CSS file is needed.