Live reviews
How this page is built
the gem renders it — this is all you write
The gem gives every row a dom_id, so a Turbo morph refresh updates only changed rows (no flicker, scroll preserved). This demo fakes the trigger with a 2-second JS poll; in production you'd drop the poll, add broadcasts_refreshes to the model and turbo_stream_from here — the markup the gem emits already satisfies it. Click the button (or add a review in a second tab) and watch a row morph in.
app/models/review.rb
broadcasts_refreshes # production: push a refresh when a review changes
app/views/live/index.html.erb
<%= turbo_stream_from :reviews %> <%# production: subscribe to live updates %>
<%= crud_collection @reviews, query: :static %>
Read more: Turbo Streams
| Book | Reviewer name | Rating | Body | Created at | |
|---|---|---|---|---|---|
| The Silent Winter 120 | Alan | ★★★★☆ | A classic in the making. The world-building is superb. | 16 Aug 12:46 | |
| The Silent Winter 120 | Ada | ★★★☆☆ | A classic in the making. | 16 Aug 12:46 | |
| The Silent Winter 120 | Ada | ★★★☆☆ | Slow start, great finish. | 16 Aug 12:46 | |
| The Silent Winter 120 | Ada | ★★★★☆ | Not my cup of tea. The world-building is superb. | 16 Aug 12:46 | |
| The Distant Door 119 | Radia | ★★☆☆☆ | Read it twice already. | 16 Aug 12:46 | |
| The Distant Door 119 | Edsger | ★★☆☆☆ | A classic in the making. Could not put it down. | 16 Aug 12:46 | |
| The Distant Door 119 | Donald | ★☆☆☆☆ | Could not put it down. | 16 Aug 12:46 | |
| The Distant Winter 118 | Radia | ★★☆☆☆ | Slow start, great finish. Could not put it down. | 16 Aug 12:46 |