OSS TanbouSign in with GitHub

Add pagination to Ruby web apps with chainable scopes and rendering helpers

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
8,667
Primary language
Ruby
License
MIT
Repository last updated
Feb 20, 2026
On this page

Overview

Kaminari is a library for adding pagination to Rails and other Ruby web applications. Queries chain the page and per scopes, while views use the paginate helper to render navigation links. It keeps paginated results in the existing relation type instead of introducing a special collection class, so pagination can compose with other query conditions.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Compose pagination as part of the query chain

A query such as User.order(:name).page(params[:page]).per(50) adds the page number and page size after ordering or filtering. The result remains an AR::Relation, allowing other conditions to be chained before or after the pagination scopes.

Sources: [1]

Adapt navigation rendering and defaults to the application

The paginate helper generates page links wrapped in an HTML5 nav element. Each element is rendered from partial templates inside the Engine, which applications can override to change presentation and behavior. Configuration also covers defaults such as page size, maximum page size, window widths, and the parameter name.

Sources: [1]

Best fit

Fits incremental pagination work in Rails lists and administration screens

Kaminari fits Rails applications that use ActiveRecord and need to paginate existing search and sort queries without changing their overall query style. The README also documents support for Sinatra, Grape, Mongoid, and other Ruby components, making it a candidate for teams seeking a shared pagination approach across several Ruby stacks.

Sources: [1]

Before adoption

Confirm ordering, limits, and version compatibility

Kaminari does not add ordering to a query. Applications should specify order so records remain stable as users move between pages. The per scope overrides an earlier limit, so screens that accept a user-selected page size should enforce a ceiling such as max_per_page.

The current README lists Ruby 2.1 through 3.3 and Rails 4.1 through 8.0 among its supported versions. The latest GitHub Release is still v1.2.2, so the release timeline and compatibility table on the default branch do not move together. Test the exact Ruby and Rails versions in use and review dependencies and project changes before adoption.

Sources: [1][2]

Official sources

  1. [1]Kaminari README at reviewed commit(2026-10-04)
  2. [2]Kaminari v1.2.2 release(2026-10-04)
Supplemental curator note

Kaminari is compelling when pagination should remain part of an AR::Relation query chain. Pair it with explicit ordering and application-level limits for page size and maximum pages so results remain predictable and expensive queries stay bounded.

Try it in 3 steps

  1. 1

    Add the gem

    This assumes an existing Rails application with an ActiveRecord User model (including name) and an index controller action plus ERB view; add the gem to its Gemfile.

    gem 'kaminari'
  2. 2

    Install dependencies

    Run Bundler from the Rails application root to install Kaminari and its dependencies.

    bundle
  3. 3

    Connect the collection and navigation

    Place the first line in the index action of the list controller and the second in its ERB view. These are separate Ruby and template snippets, not one shell command.

    @users = User.order(:name).page(params[:page]) <%= paginate @users %>
Check the official README

Growth

Growth trends · Last 30 days

8,667 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
0
Open PRs
25

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • ruby
  • rails
  • pagination
  • kaminari
Stars
8,667
Forks
1,072
Watchers
118
Open issues
51
Contributors
153
Owner type
Organization
Primary language
Ruby
License
MIT
Repository last updated
Feb 20, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?