Edit author
How this page is built
the gem renders it — this is all you write
A fully derived form on a zero-config model (validations still apply). The permit list comes from CrudComponents.permitted_attributes — no model changes needed, and it can't drift from the form.
app/controllers/authors_controller.rb
def update
@author.update(author_params) ? redirect_to(@author) : render(:edit, status: :unprocessable_entity)
end
def author_params
params.require(:author).permit(*CrudComponents.permitted_attributes(Author, action: :update, ability: current_ability))
end
app/views/authors/edit.html.erb
<%= crud_form @author %>
Read more: Forms · The permit list