Pass validation errors in JSON endpoint
This commit is contained in:
parent
1292c158ce
commit
bf2a040cf9
2 changed files with 2 additions and 2 deletions
|
@ -7,7 +7,7 @@ module Groups
|
||||||
format.json do
|
format.json do
|
||||||
return head :ok if @group.update(variables_params)
|
return head :ok if @group.update(variables_params)
|
||||||
|
|
||||||
head :bad_request
|
render status: :bad_request, json: @group.errors.to_hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Projects::VariablesController < Projects::ApplicationController
|
||||||
format.json do
|
format.json do
|
||||||
return head :ok if @project.update(variables_params)
|
return head :ok if @project.update(variables_params)
|
||||||
|
|
||||||
head :bad_request
|
render status: :bad_request, json: @project.errors.to_hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue