Skip to content

Commit cd05e3e

Browse files
authored
Update calls to unprocessable_entity to unprocessable_content per warning (#312)
1 parent 686e4ae commit cd05e3e

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

app/controllers/api/v1/annotations_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def create
1313
if @annotation.save
1414
render json: @annotation, status: :ok
1515
else
16-
render json: {}, status: :unprocessable_entity
16+
render json: {}, status: :unprocessable_content
1717
end
1818
end
1919

@@ -22,7 +22,7 @@ def update
2222
if @annotation.update(annotation: params[:annotation])
2323
render json: @annotation, status: :ok
2424
else
25-
render json: {}, status: :unprocessable_entity
25+
render json: {}, status: :unprocessable_content
2626
end
2727
end
2828

@@ -32,7 +32,7 @@ def destroy
3232
@annotation.destroy
3333
render json: @annotation, status: :ok
3434
else
35-
render json: {}, status: :unprocessable_entity
35+
render json: {}, status: :unprocessable_content
3636
end
3737
end
3838
end

app/controllers/events_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def create
2929
format.html { redirect_to events_path, notice: "Event was successfully created." }
3030
format.json { render :show, status: :created, location: @event }
3131
else
32-
format.html { render :new, status: :unprocessable_entity }
33-
format.json { render json: @event.errors, status: :unprocessable_entity }
32+
format.html { render :new, status: :unprocessable_content }
33+
format.json { render json: @event.errors, status: :unprocessable_content }
3434
end
3535
end
3636
end
@@ -41,8 +41,8 @@ def update
4141
format.html { redirect_to events_path, notice: "Event was successfully updated." }
4242
format.json { render :show, status: :ok, location: @event }
4343
else
44-
format.html { render :edit, status: :unprocessable_entity }
45-
format.json { render json: @event.errors, status: :unprocessable_entity }
44+
format.html { render :edit, status: :unprocessable_content }
45+
format.json { render json: @event.errors, status: :unprocessable_content }
4646
end
4747
end
4848
end

app/controllers/facilitators_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def create
3030
if @facilitator.save
3131
format.html { redirect_to @facilitator, notice: "Facilitator was successfully created." }
3232
else
33-
format.html { render :new, status: :unprocessable_entity }
33+
format.html { render :new, status: :unprocessable_content }
3434
end
3535
end
3636
end
@@ -40,7 +40,7 @@ def update
4040
if @facilitator.update(facilitator_params)
4141
format.html { redirect_to @facilitator, notice: "Facilitator was successfully updated." }
4242
else
43-
format.html { render :edit, status: :unprocessable_entity }
43+
format.html { render :edit, status: :unprocessable_content }
4444
end
4545
end
4646
end

app/controllers/faqs_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def create
2828
redirect_to faqs_path, notice: "FAQ was successfully created."
2929
else
3030
set_form_variables
31-
render :new, status: :unprocessable_entity
31+
render :new, status: :unprocessable_content
3232
end
3333
end
3434

@@ -37,7 +37,7 @@ def update
3737
redirect_to faqs_path, notice: "FAQ was successfully updated.", status: :see_other
3838
else
3939
set_form_variables
40-
render :edit, status: :unprocessable_entity
40+
render :edit, status: :unprocessable_content
4141
end
4242
end
4343

app/controllers/users_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def create
3535
redirect_to users_path, notice: "User was successfully created."
3636
else
3737
set_form_variables
38-
render :new, status: :unprocessable_entity
38+
render :new, status: :unprocessable_content
3939
end
4040
end
4141

@@ -54,7 +54,7 @@ def update
5454
else
5555
flash[:alert] = 'Unable to update user.'
5656
set_form_variables
57-
render :edit, status: :unprocessable_entity
57+
render :edit, status: :unprocessable_content
5858
end
5959
end
6060

app/controllers/workshop_logs_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create
4848
redirect_to authenticated_root_path
4949
else
5050
set_form_variables
51-
render :new, status: :unprocessable_entity
51+
render :new, status: :unprocessable_content
5252
end
5353
end
5454

lib/templates/rails/scaffold_controller/controller.rb.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class <%= controller_class_name %>Controller < ApplicationController
2626
redirect_to <%= index_helper %>_path, notice: "<%= human_name %> was successfully created."
2727
else
2828
set_form_variables
29-
render :new, status: :unprocessable_entity
29+
render :new, status: :unprocessable_content
3030
end
3131
end
3232

@@ -35,7 +35,7 @@ class <%= controller_class_name %>Controller < ApplicationController
3535
redirect_to <%= index_helper %>_path, notice: "<%= human_name %> was successfully updated.", status: :see_other
3636
else
3737
set_form_variables
38-
render :edit, status: :unprocessable_entity
38+
render :edit, status: :unprocessable_content
3939
end
4040
end
4141

spec/requests/events_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
it "renders a response with validation errors (i.e. to display the 'new' template)" do
133133
sign_in user
134134
post events_url, params: { event: invalid_attributes }
135-
expect(response).to have_http_status(:unprocessable_entity)
135+
expect(response).to have_http_status(:unprocessable_content)
136136
end
137137
end
138138
end

0 commit comments

Comments
 (0)