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
No records