Grouped table
How this page is built
the gem renders it — this is all you write
Grouping is a render-time arrangement, like the layout. Add group_by: :genre — the gem orders by the group key, splits the rows into collapsible groups (chevron in the header) and shows a per-group count. With 12 books, groups start collapsed beyond config.group_collapse_threshold (default 50), opening only the first; the open ones live in ?open=, so a half-expanded view is copy-pasteable.
app/views/groups/index.html.erb
<%= crud_collection @books, group_by: :genre %> <%# belongs_to, enum or a column %>
Read more: Grouping
| Cover | Title | Author names | Genre | Price | Publisher | Active | ||
|---|---|---|---|---|---|---|---|---|
|
|
||||||||
| Scifi 5 | ||||||||
![]() |
The Silent Tower 3 | Stanisław Lem and Martha Wells | Scifi | 43.93 € | Vintage | ✓ | ||
![]() |
The Burning Machine 7 | Octavia Butler | Scifi | 10.40 € | — | ✓ | ||
![]() |
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 Quiet Station 12 | Joe Abercrombie | Scifi | 11.40 € | Gollancz | ✓ | ||



