Column headers & actions
A dynamic column often is a domain object — here every PropertyDefinition becomes a column whose <th> carries a link (via header:) and its own bulk action (via header_actions:). The action is declared on: :selection, so it submits the same shared select-form the toolbar's bulk actions use: tick a few rows, hit Tag in a column, and the checked selected[] reach that column's endpoint — acting on the ticked rows × that column's object. Declaring a :selection header action is what makes the table selectable (the checkboxes appear) — no extra wiring. header: replaces only the human_name; the same options work on a declared attribute too, not just a DynamicColumn.
@columns = PropertyDefinition.order(:id).map do |defn|
CrudComponents::DynamicColumn.new(defn.key.to_sym,
label: defn.label,
header: -> { link_to defn.label, columns_path(anchor: defn.key) }, # replaces only the human_name
header_actions: [
# acts on the TICKED rows × this column (defn); submits the shared select-form
CrudComponents::Action.new(:tag_selected, on: :selection, icon: 'tag', method: :post) do
tag_column_headers_path(key: defn.key)
end
],
preload: ->(records) { defn.values_by_subject(Book, records) }
) { |record, loaded| defn.cast(loaded[record.id]&.value) }
end
def tag # the :selection header action's target
books = CrudComponents.selected(Book, params) # resolves the ticked selected[] slugs
redirect_to column_headers_path,
notice: "Tagged #{books.count} book(s) for '#{params[:key]}'…"
end
Read more: Custom headers & column actions · Dynamic columns
| Title | Price | Shelf | Weight | Signed | Acquired | Shelf tag | ||
|---|---|---|---|---|---|---|---|---|
|
|
|
|||||||
| The Hidden Forest 1 | 28.24 € | A1 | 191.0 | ✗ | 2022-07-15 | tag:A1 | ||
| The Endless Mirror 2 | 28.63 € | B1 | 462.0 | ✗ | 2022-12-26 | tag:B1 | ||
| The Ancient Winter 3 | 24.81 € | C2 | 276.0 | ✓ | 2025-04-30 | tag:C2 | ||
| The Dispossessed City 4 | 19.95 € | B2 | 248.0 | ✗ | 2024-06-15 | tag:B2 | ||
| The Quiet Mirror 5 | 32.73 € | B1 | 212.0 | ✗ | 2026-10-01 | tag:B1 | ||
| The Burning Winter 6 | 21.78 € | A1 | 198.0 | ✗ | 2026-05-07 | tag:A1 | ||
| The Dispossessed City 7 | 17.82 € | B1 | 629.0 | ✗ | 2025-05-10 | tag:B1 | ||
| The Quiet Forest 8 | 11.98 € | Reserve | 631.0 | ✓ | 2023-09-12 | tag:Reserve | ||
| The Broken Engine 9 | 32.99 € | B2 | 873.0 | ✓ | 2022-06-19 | tag:B2 | ||
| The Distant City 10 | 26.91 € | Reserve | 705.0 | ✓ | 2022-12-24 | tag:Reserve | ||
| The Endless Station 11 | 10.86 € | C2 | 656.0 | ✗ | 2025-10-12 | tag:C2 | ||
| The Dispossessed Station 12 | 16.58 € | C1 | 517.0 | ✓ | 2024-12-06 | tag:C1 | ||
| The Endless Station 13 | 27.05 € | A1 | 748.0 | ✗ | 2026-04-16 | tag:A1 | ||
| The Hidden Mirror 14 | 22.58 € | C2 | 848.0 | ✗ | 2026-11-03 | tag:C2 | ||
| The Endless Forest 15 | 11.84 € | A2 | 697.0 | ✗ | 2023-03-12 | tag:A2 | ||
| The Ancient Signal 16 | 35.51 € | B2 | 497.0 | ✓ | 2021-06-10 | tag:B2 | ||
| The Endless Dune 17 | 18.69 € | A2 | 653.0 | ✗ | 2025-09-21 | tag:A2 | ||
| The Quiet Door 18 | 21.79 € | A1 | 910.0 | ✓ | 2023-07-11 | tag:A1 | ||
| The Hidden Mirror 19 | 37.51 € | Reserve | 566.0 | ✗ | 2026-08-14 | tag:Reserve | ||
| The Burning Tower 20 | 14.56 € | A1 | 387.0 | ✗ | 2022-05-05 | tag:A1 | ||
| The Endless City 21 | 36.46 € | A2 | 345.0 | ✗ | 2026-06-19 | tag:A2 | ||
| The Hidden Archive 22 | 23.21 € | B1 | 618.0 | ✓ | 2026-04-15 | tag:B1 | ||
| The Hidden Engine 23 | 40.55 € | C1 | 674.0 | ✗ | 2026-10-31 | tag:C1 | ||
| The Ancient Mirror 24 | 33.42 € | B1 | 732.0 | ✗ | 2026-06-25 | tag:B1 | ||
| The Endless Winter 25 | 41.02 € | B2 | 582.0 | ✗ | 2022-10-05 | tag:B2 | ||
| The Distant Door 26 | 16.40 € | Reserve | 593.0 | ✓ | 2024-09-09 | tag:Reserve | ||
| The Quiet City 27 | 39.79 € | C2 | 313.0 | ✓ | 2023-04-23 | tag:C2 | ||
| The Endless Winter 28 | 29.97 € | A2 | 252.0 | ✓ | 2023-02-13 | tag:A2 | ||
| The Dispossessed Winter 29 | 9.04 € | C2 | 924.0 | ✓ | 2026-08-12 | tag:C2 | ||
| The Endless Winter 30 | 39.19 € | B1 | 687.0 | ✗ | 2025-10-03 | tag:B1 | ||
| The Hidden Engine 31 | 32.85 € | B2 | 244.0 | ✓ | 2023-08-30 | tag:B2 | ||
| The Hidden Winter 32 | 40.79 € | A1 | 445.0 | ✓ | 2023-11-13 | tag:A1 | ||
| The Endless Signal 33 | 39.74 € | B1 | 841.0 | ✓ | 2025-05-09 | tag:B1 | ||
| The Distant Garden 34 | 25.55 € | C1 | 427.0 | ✗ | 2024-07-05 | tag:C1 | ||
| The Endless Door 35 | 24.06 € | A2 | 593.0 | ✓ | 2026-02-09 | tag:A2 | ||
| The Burning Door 36 | 31.42 € | A1 | 480.0 | ✗ | 2024-01-24 | tag:A1 | ||
| The Broken Mirror 37 | 7.28 € | A1 | 316.0 | ✗ | 2026-08-29 | tag:A1 | ||
| The Distant Forest 38 | 38.71 € | A1 | 829.0 | ✗ | 2023-11-19 | tag:A1 | ||
| The Silent Tower 39 | 25.60 € | C1 | 225.0 | ✗ | 2024-05-06 | tag:C1 | ||
| The Silent Archive 40 | 41.43 € | C2 | 355.0 | ✗ | 2025-02-01 | tag:C2 | ||
| The Luminous Machine 41 | 23.63 € | A2 | 549.0 | ✓ | 2026-09-27 | tag:A2 | ||
| The Ancient Garden 42 | 35.86 € | A2 | 598.0 | ✗ | 2022-09-11 | tag:A2 | ||
| The Ancient Garden 43 | 42.67 € | C1 | 306.0 | ✓ | 2021-07-21 | tag:C1 | ||
| The Hidden Station 44 | 12.11 € | Reserve | 450.0 | ✗ | 2022-06-05 | tag:Reserve | ||
| The Luminous City 45 | 19.30 € | B1 | 252.0 | ✓ | 2021-07-23 | tag:B1 | ||
| The Distant Engine 46 | 21.25 € | B1 | 427.0 | ✗ | 2021-12-07 | tag:B1 | ||
| The Hidden Tower 47 | 19.92 € | B1 | 556.0 | ✓ | 2026-06-03 | tag:B1 | ||
| The Broken Empire 48 | 30.49 € | A2 | 391.0 | ✓ | 2022-03-22 | tag:A2 | ||
| The Broken Dune 49 | 22.90 € | Reserve | 548.0 | ✓ | 2026-06-22 | tag:Reserve | ||
| The Burning Station 50 | 14.43 € | Reserve | 659.0 | ✗ | 2023-12-15 | tag:Reserve | ||
| The Ancient Machine 51 | 40.77 € | Reserve | 916.0 | ✓ | 2023-01-30 | tag:Reserve | ||
| The Distant Garden 52 | 36.80 € | C1 | 478.0 | ✗ | 2024-09-09 | tag:C1 | ||
| The Ancient Ocean 53 | 25.74 € | B1 | 240.0 | ✗ | 2024-04-01 | tag:B1 | ||
| The Dispossessed Empire 54 | 43.50 € | C2 | 493.0 | ✓ | 2025-12-24 | tag:C2 | ||
| The Endless Station 55 | 20.24 € | A2 | 785.0 | ✗ | 2022-09-15 | tag:A2 | ||
| The Ancient Forest 56 | 33.64 € | A2 | 517.0 | ✗ | 2025-02-19 | tag:A2 | ||
| The Luminous City 57 | 23.17 € | B1 | 343.0 | ✓ | 2026-01-05 | tag:B1 | ||
| The Broken Empire 58 | 34.83 € | C1 | 683.0 | ✗ | 2025-10-29 | tag:C1 | ||
| The Quiet Empire 59 | 39.87 € | A2 | 782.0 | ✗ | 2021-12-16 | tag:A2 | ||
| The Silent Station 60 | 34.96 € | B1 | 673.0 | ✗ | 2024-11-29 | tag:B1 | ||
| The Broken Station 61 | 18.89 € | A1 | 688.0 | ✗ | 2022-05-22 | tag:A1 | ||
| The Quiet Dune 62 | 24.14 € | A1 | 474.0 | ✓ | 2021-06-19 | tag:A1 | ||
| The Distant Tower 63 | 18.55 € | B2 | 873.0 | ✓ | 2025-02-09 | tag:B2 | ||
| The Dispossessed Forest 64 | 36.11 € | A2 | 747.0 | ✓ | 2024-07-20 | tag:A2 | ||
| The Hidden Ocean 65 | 43.18 € | A2 | 624.0 | ✗ | 2025-11-22 | tag:A2 | ||
| The Dispossessed City 66 | 29.12 € | B1 | 367.0 | ✗ | 2025-01-09 | tag:B1 | ||
| The Ancient Dune 67 | 38.41 € | B2 | 805.0 | ✗ | 2022-05-22 | tag:B2 | ||
| The Luminous Forest 68 | 40.60 € | C1 | 514.0 | ✗ | 2022-08-19 | tag:C1 | ||
| The Endless City 69 | 40.98 € | A2 | 242.0 | ✗ | 2025-06-26 | tag:A2 | ||
| The Silent Station 70 | 34.46 € | B1 | 877.0 | ✓ | 2023-07-10 | tag:B1 | ||
| The Ancient Engine 71 | 32.68 € | B2 | 393.0 | ✗ | 2026-07-08 | tag:B2 | ||
| The Distant Dune 72 | 32.20 € | C1 | 267.0 | ✗ | 2024-03-07 | tag:C1 | ||
| The Endless Signal 73 | 19.39 € | Reserve | 308.0 | ✓ | 2024-01-28 | tag:Reserve | ||
| The Ancient Ocean 74 | 14.70 € | C2 | 933.0 | ✓ | 2023-01-11 | tag:C2 | ||
| The Hidden Tower 75 | 5.34 € | C2 | 217.0 | ✓ | 2024-02-16 | tag:C2 | ||
| The Luminous Engine 76 | 34.79 € | C1 | 824.0 | ✓ | 2024-12-06 | tag:C1 | ||
| The Luminous Tower 77 | 28.81 € | B2 | 200.0 | ✗ | 2025-08-22 | tag:B2 | ||
| The Hidden Engine 78 | 8.00 € | B1 | 800.0 | ✓ | 2022-06-14 | tag:B1 | ||
| The Hidden Dune 79 | 24.25 € | B1 | 248.0 | ✓ | 2026-05-08 | tag:B1 | ||
| The Ancient Engine 80 | 17.29 € | B2 | 623.0 | ✓ | 2026-01-12 | tag:B2 | ||
| The Burning Forest 81 | 6.28 € | A2 | 714.0 | ✓ | 2026-02-16 | tag:A2 | ||
| The Dispossessed Archive 82 | 35.72 € | C1 | 498.0 | ✗ | 2026-09-29 | tag:C1 | ||
| The Distant Engine 83 | 39.52 € | A1 | 928.0 | ✓ | 2021-11-08 | tag:A1 | ||
| The Luminous Mirror 84 | 19.40 € | Reserve | 568.0 | ✗ | 2025-03-08 | tag:Reserve | ||
| The Luminous City 85 | 22.63 € | A2 | 356.0 | ✗ | 2026-01-10 | tag:A2 | ||
| The Distant Station 86 | 12.86 € | Reserve | 276.0 | ✓ | 2023-07-02 | tag:Reserve | ||
| The Quiet Door 87 | 35.06 € | C1 | 316.0 | ✗ | 2024-02-13 | tag:C1 | ||
| The Luminous Tower 88 | 37.25 € | C1 | 726.0 | ✓ | 2025-01-27 | tag:C1 | ||
| The Dispossessed Empire 89 | 11.61 € | A1 | 809.0 | ✓ | 2022-12-01 | tag:A1 | ||
| The Quiet Tower 90 | 31.01 € | Reserve | 644.0 | ✗ | 2025-08-06 | tag:Reserve | ||
| The Hidden Tower 91 | 29.28 € | B1 | 593.0 | ✓ | 2024-06-08 | tag:B1 | ||
| The Hidden Winter 92 | 29.93 € | C2 | 636.0 | ✓ | 2023-06-06 | tag:C2 | ||
| The Ancient Forest 93 | 41.21 € | C1 | 778.0 | ✓ | 2025-01-17 | tag:C1 | ||
| The Luminous Station 94 | 26.90 € | C2 | 551.0 | ✓ | 2022-05-17 | tag:C2 | ||
| The Quiet Station 95 | 6.29 € | Reserve | 224.0 | ✓ | 2023-05-29 | tag:Reserve | ||
| The Distant Winter 96 | 10.36 € | C1 | 629.0 | ✓ | 2025-02-12 | tag:C1 | ||
| The Endless Engine 97 | 43.50 € | B2 | 197.0 | ✗ | 2025-01-27 | tag:B2 | ||
| The Endless Mirror 98 | 33.32 € | C2 | 468.0 | ✗ | 2024-11-29 | tag:C2 | ||
| The Hidden Garden 99 | 24.11 € | C2 | 414.0 | ✗ | 2024-04-26 | tag:C2 | ||
| The Burning Archive 100 | 24.48 € | B1 | 813.0 | ✗ | 2024-02-04 | tag:B1 | ||
| The Dispossessed Ocean 101 | 12.58 € | B1 | 853.0 | ✓ | 2023-06-11 | tag:B1 | ||
| The Broken City 102 | 40.54 € | B2 | 190.0 | ✗ | 2022-03-23 | tag:B2 | ||
| The Dispossessed Door 103 | 30.10 € | Reserve | 738.0 | ✗ | 2023-09-26 | tag:Reserve | ||
| The Broken Forest 104 | 17.49 € | B1 | 297.0 | ✓ | 2023-01-14 | tag:B1 | ||
| The Endless Ocean 105 | 34.90 € | B2 | 843.0 | ✗ | 2025-11-22 | tag:B2 | ||
| The Hidden Door 106 | 19.30 € | C1 | 316.0 | ✓ | 2023-04-17 | tag:C1 | ||
| The Hidden Door 107 | 17.84 € | C2 | 660.0 | ✓ | 2026-05-09 | tag:C2 | ||
| The Luminous Ocean 108 | 39.89 € | A2 | 354.0 | ✗ | 2025-08-28 | tag:A2 | ||
| The Hidden Garden 109 | 22.95 € | C1 | 533.0 | ✓ | 2026-07-02 | tag:C1 | ||
| The Burning Station 110 | 24.38 € | C2 | 272.0 | ✗ | 2026-03-26 | tag:C2 | ||
| The Distant Archive 111 | 11.59 € | C1 | 739.0 | ✓ | 2026-03-20 | tag:C1 | ||
| The Dispossessed Signal 112 | 38.73 € | C1 | 474.0 | ✗ | 2024-07-17 | tag:C1 | ||
| The Quiet Forest 113 | 33.56 € | A2 | 196.0 | ✓ | 2023-05-07 | tag:A2 | ||
| The Ancient Archive 114 | 44.21 € | C1 | 484.0 | ✓ | 2024-01-24 | tag:C1 | ||
| The Silent Engine 115 | 24.38 € | A2 | 282.0 | ✓ | 2026-05-11 | tag:A2 | ||
| The Silent Archive 116 | 10.28 € | A1 | 753.0 | ✓ | 2026-06-02 | tag:A1 | ||
| The Endless Empire 117 | 29.30 € | A1 | 430.0 | ✓ | 2023-01-09 | tag:A1 | ||
| The Burning Empire 118 | 17.01 € | Reserve | 720.0 | ✓ | 2025-09-30 | tag:Reserve | ||
| The Ancient Archive 119 | 21.49 € | A2 | 559.0 | ✗ | 2026-10-26 | tag:A2 | ||
| The Silent Station 120 | 42.11 € | C2 | 847.0 | ✓ | 2025-02-26 | tag:C2 | ||