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: :publisher — the gem orders by the group key, splits the rows into collapsible groups (chevron in the header) and shows a per-group count. With 20 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: :publisher %>   <%# belongs_to, enum or a column %>

Read more: Grouping

Cover Title Author names Genre Price Publisher Active
— 3
Tor Books 1
Ace 3
The Quiet Forest 8 Becky Chambers Fiction 11.98 € Ace ✗
The Hidden Mirror 14 Ursula Le Guin and Kim Robinson Nonfiction 22.58 € Ace ✗
— The Burning Tower 20 Ann Leckie Scifi 14.56 € Ace ✓
Orbit 1
Gollancz 2
The Broken Engine 9 Ted Chiang, Ann Leckie, and Frank Herbert Fiction 32.99 € Gollancz ✗
The Quiet Door 18 Becky Chambers Scifi 21.79 € Gollancz ✗
DAW 3
Baen 1
The Dispossessed Station 12 Martha Wells and Ann Leckie Nonfiction 16.58 € Baen ✓
Del Rey 3
The Quiet Mirror 5 Kim Robinson, Liu Cixin, and Becky Chambers Nonfiction 32.73 € Del Rey ✓
The Endless Forest 15 Octavia Butler, Ann Leckie, and Liu Cixin Scifi 11.84 € Del Rey ✓
The Ancient Signal 16 Joe Abercrombie Scifi 35.51 € Del Rey ✗
Vintage 3
The Endless Mirror 2 Ann Leckie, Mary Shelley, and Ursula Le Guin Nonfiction 28.63 € Vintage ✓
The Dispossessed City 7 Liu Cixin, Octavia Butler, and Kim Robinson Fiction 17.82 € Vintage ✓
The Hidden Mirror 19 Joe Abercrombie, Ursula Le Guin, and Adrian Tchaikovsky Fiction 37.51 € Vintage ✓