Quick Start
Migrating from another pagination gem?
Check the Migration Guide first
Steps
Gemfile
gem 'pagy', '~> 43.4' # Omit the patch segment to avoid breaking changes
pagy method where you are going to use it (usually ApplicationController):
include Pagy::Method
@pagy, @records = pagy(:offset, Product.some_scope, **options) # :offset paginator
@pagy, @records = pagy(:keyset, Product.some_scope, **options) # :keyset paginator
@pagy, @records = pagy(...)
Read the Choose Right guide to pick the right paginators for your app
@pagy instance methods:
<%# Render navigation bar helpers with various types and styles %>
<%== @pagy.series_nav %>
<%== @pagy.series_nav_js(:bootstrap) %>
<%== @pagy.input_nav_js(:bulma) %>
<%== @pagy.info_tag %>
See all the available @pagy helpers