Pagination
How this page is built
the gem renders it — this is all you write
The gem doesn't paginate on its own (no surprise row limits). You paginate in your controller with your own gem — here kaminari — and because a kaminari-paginated relation carries its page state, crud_collection notices and renders the footer pager automatically. The pager's ?page= composes with the gem's own filter/sort params (120 seeded books, 8 per page).
app/controllers/books_controller.rb
@query = CrudComponents::Query.new(Book, params, fieldset: :index, ability: current_ability)
@books = @query.apply(Book.all).page(params[:page]).per(8) # kaminari
app/views/pagination/index.html.erb
<%= crud_collection @books, query: @query %> <%# the footer pager renders itself %>
Read more: Pagination
| Cover | Title | Author names | Genre | Price | Publisher | Active | ||
|---|---|---|---|---|---|---|---|---|
|
|
|
|||||||
![]() |
The Luminous Garden 65 | Liu Cixin and Ursula Le Guin | Scifi | 6.67 € | Ace | ✓ | ||
![]() |
The Hidden Station 66 | Octavia Butler and Iain Banks | Scifi | 40.83 € | Vintage | ✓ | ||
![]() |
The Dispossessed Ocean 67 | Martha Wells | Fiction | 40.62 € | Tor Books | ✗ | ||
![]() |
The Broken Ocean 68 | Kim Robinson and Stanisław Lem | Nonfiction | 6.07 € | Tor Books | ✗ | ||
![]() |
The Broken Empire 69 | Ted Chiang | Nonfiction | 29.21 € | — | ✓ | ||
![]() |
The Luminous Mirror 70 | Adrian Tchaikovsky, Frank Herbert, and Margaret Atwood | Scifi | 8.90 € | Ace | ✓ | ||
![]() |
The Silent Signal 71 | Margaret Atwood, Ursula Le Guin, and Iain Banks | Scifi | 35.42 € | Del Rey | ✓ | ||
![]() |
The Ancient City 72 | Stanisław Lem, Mary Shelley, and Frank Herbert | Fiction | 34.41 € | Orbit | ✓ | ||







