Edit review
How this page is built
the gem renders it — this is all you write
A derived form including the belongs_to :book select. fieldset :form orders the fields; the permit list is the gem's, in lockstep with the form.
app/models/review.rb
crud_structure do
fieldset :form, %i[book rating body reviewer_name]
end
app/controllers/reviews_controller.rb
def review_params
params.require(:review).permit(*CrudComponents.permitted_attributes(Review, action: :update, ability: current_ability))
end
app/views/reviews/edit.html.erb
<%= crud_form @review %>
Read more: Forms · Associations