Reviews

How this page is built the gem renders it — this is all you write

The rating column uses a custom renderer — one partial in your app (_stars.html.erb) named by as: :stars. Search delegates through :book into Book's own search_in (try a publisher name). Your controller assigns @reviews.

app/models/review.rb
crud_structure do
  search_in :reviewer_name, :body, :book   # :book delegates into Book's search_in
  attribute :rating, as: :stars            # → app/views/crud_components/fields/_stars.html.erb
  fieldset :index, %i[book reviewer_name rating body created_at]
end
app/views/reviews/index.html.erb
<%= crud_collection @reviews %>

Read more: Renderers  ·  The like-spec

Reset
Book Reviewer name Rating Body Created at
Reset
The Luminous City 45 Linus ★★★★★ The world-building is superb. A classic in the making. 29 Jun 01:16
The Luminous City 45 Donald ★★★☆☆ Slow start, great finish. Read it twice already. 29 Jun 01:16
The Luminous City 45 Grace ☆☆☆☆ The world-building is superb. 29 Jun 01:16
The Luminous City 45 Alan ☆☆☆☆ A classic in the making. Read it twice already. 29 Jun 01:16