How this page is built
the gem renders it — this is all you write
A full table — search, an inline filter row, sortable columns and row actions — all derived from the model. This page toggles between the curated :index and the fuller :catalog fieldset (currently :index). Your controller assigns @books — scope it for authorization (e.g. Book.accessible_by(current_ability)) and the gem renders that scope.
app/models/book.rb
crud_structure do
attribute :price, as: :number, unit: '€', digits: 2
fieldset :index, %i[cover title author_names genre price publisher active]
fieldset :catalog, %i[cover title subtitle author_names genre price purchase_price
shop_margin pages published_on publisher reviews active manual created_at]
end
app/views/books/index.html.erb
<%= crud_collection @books, fieldset: :index %> <%# search, filters, sort, actions %>
<%= crud_filter Book, fieldset: :index %> <%# filter sidebar (takes the model, not a scope) %>
Read more: Fields & cells · Views & fieldsets
| Cover | Title | Author names | Genre | Price | Publisher | Active | ||
|---|---|---|---|---|---|---|---|---|
|
|
||||||||
![]() |
The Ancient Ocean 17 | Martha Wells, Ted Chiang, and Stanisław Lem | Fiction | 34.01 € | Baen | ✓ | ||
![]() |
The Ancient Ocean 19 | Frank Herbert | Fiction | 43.54 € | Baen | ✓ | ||
![]() |
The Hidden Door 22 | Frank Herbert | Fiction | 30.21 € | Baen | ✓ | ||
![]() |
The Broken Dune 63 | Liu Cixin and Mary Shelley | Fiction | 6.27 € | Baen | ✓ | ||
![]() |
The Luminous Ocean 64 | Becky Chambers and Stanisław Lem | Fiction | 33.85 € | Baen | ✓ | ||
![]() |
The Ancient Signal 88 | Becky Chambers and Frank Herbert | Fiction | 19.15 € | Baen | ✓ | ||
![]() |
The Hidden Door 95 | Mary Shelley | Fiction | 21.22 € | Baen | ✓ | ||
![]() |
The Luminous Empire 97 | Liu Cixin | Fiction | 13.61 € | Baen | ✓ | ||







