Skip to content

Commit

Permalink
Satisfy Turbo requirement for 422 response on form errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Jan 22, 2021
1 parent ef85b03 commit 445e316
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/generators/rails/templates/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def create
format.html { redirect_to @<%= singular_table_name %>, notice: <%= %("#{human_name} was successfully created.") %> }
format.json { render :show, status: :created, location: <%= "@#{singular_table_name}" %> }
else
format.html { render :new }
format.html { render :new, status: :unprocessable_entity }
format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
end
end
Expand All @@ -50,7 +50,7 @@ def update
format.html { redirect_to @<%= singular_table_name %>, notice: <%= %("#{human_name} was successfully updated.") %> }
format.json { render :show, status: :ok, location: <%= "@#{singular_table_name}" %> }
else
format.html { render :edit }
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
end
end
Expand Down

0 comments on commit 445e316

Please sign in to comment.