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 Hidden Dune 9 | Iain Banks | Scifi | 42.43 € | Orbit | ✓ | ||
![]() |
The Broken Dune 10 | Liu Cixin, Margaret Atwood, and Martha Wells | Scifi | 13.54 € | Del Rey | ✓ | ||
![]() |
The Ancient Tower 11 | Ted Chiang, Ann Leckie, and Frank Herbert | Fiction | 40.82 € | Gollancz | ✗ | ||
![]() |
The Quiet Station 12 | Joe Abercrombie | Scifi | 11.40 € | Gollancz | ✓ | ||
![]() |
The Hidden Engine 13 | Margaret Atwood and Frank Herbert | Nonfiction | 33.63 € | Gollancz | ✓ | ||
![]() |
The Endless Machine 14 | Ann Leckie, Ursula Le Guin, and Joe Abercrombie | Fiction | 8.37 € | Gollancz | ✓ | ||
![]() |
The Endless Garden 15 | Ursula Le Guin, Joe Abercrombie, and Adrian Tchaikovsky | Nonfiction | 29.85 € | Orbit | ✓ | ||
![]() |
The Hidden Garden 16 | Joe Abercrombie, Ted Chiang, and Becky Chambers | Fiction | 30.44 € | Tor Books | ✓ | ||







