Skip to content

Commit 445e316

Browse files
author
David Heinemeier Hansson
committed
Satisfy Turbo requirement for 422 response on form errors
1 parent ef85b03 commit 445e316

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/generators/rails/templates/controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def create
3636
format.html { redirect_to @<%= singular_table_name %>, notice: <%= %("#{human_name} was successfully created.") %> }
3737
format.json { render :show, status: :created, location: <%= "@#{singular_table_name}" %> }
3838
else
39-
format.html { render :new }
39+
format.html { render :new, status: :unprocessable_entity }
4040
format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
4141
end
4242
end
@@ -50,7 +50,7 @@ def update
5050
format.html { redirect_to @<%= singular_table_name %>, notice: <%= %("#{human_name} was successfully updated.") %> }
5151
format.json { render :show, status: :ok, location: <%= "@#{singular_table_name}" %> }
5252
else
53-
format.html { render :edit }
53+
format.html { render :edit, status: :unprocessable_entity }
5454
format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
5555
end
5656
end

0 commit comments

Comments
 (0)