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.
Official sources
- [1]Kaminari README at reviewed commit(2026-10-04)
- [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
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
Install dependencies
Run Bundler from the Rails application root to install Kaminari and its dependencies.
bundle - 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 %>
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
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- ActiveAdmin9,713 Stars
2 shared tag(s) · 1 shared category(s) · Same language
embed an administration engine in Rails and define resources and actions through a DSL
Ruby - Bullet7,337 Stars
2 shared tag(s) · 1 shared category(s) · Same language
detect ActiveRecord and Mongoid N+1 queries, unused eager loading, and counter-cache opportunities during development
Ruby - CanCanCan5,682 Stars
2 shared tag(s) · 1 shared category(s) · Same language
centralize Rails authorization rules in Ability objects and reuse the same access policy across controllers, views, and queries
Ruby - Draper5,277 Stars
2 shared tag(s) · 1 shared category(s) · Same language
wrap Rails models with decorators and view models so presentation logic stays out of models and global helpers
Ruby - Flutter179,318 Stars
1 shared tag(s) · 2 shared category(s)
build mobile, web, and desktop UI from one Dart codebase
Dart - Angular101,014 Stars
1 shared tag(s) · 2 shared category(s)
Unify components, signals/DI, routing, forms, SSR/hydration, and CLI tooling in one TypeScript web application platform
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.