Oops, return HTTP Bad Request when item editing fails

Just a subtle thing, but Turbo can be picky about return types, and
won't reload the page with the errors in it if the status is 200.
This commit is contained in:
Emi Matchu 2024-11-30 11:45:35 -08:00
parent 3cd02baa09
commit 2d3d4051fe

View file

@ -124,7 +124,7 @@ class ItemsController < ApplicationController
flash[:notice] = "\"#{@item.name}\" successfully saved!"
redirect_to @item
else
render action: "edit", layout: "application"
render action: "edit", layout: "application", status: :bad_request
end
end