aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/api
diff options
context:
space:
mode:
authorTeddy Wing2017-11-08 18:37:47 +0100
committercedricnjanga2017-11-13 17:52:54 +0100
commit89f518891cff138643eaa14977aa20a3ef01930d (patch)
tree7eef684875ba54e6853ad5d6b32b9ea89fdafb0e /app/controllers/api
parent80f932d417744488c7dadc53d7369ca573f1fc61 (diff)
downloadchouette-core-89f518891cff138643eaa14977aa20a3ef01930d.tar.bz2
ComplianceCheckSets#validated: Add response body
On successful status update, respond with the `ComplianceCheckSet` object attributes. Otherwise, respond with an error JSON. Refs #4757
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/compliance_check_sets_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/api/v1/compliance_check_sets_controller.rb b/app/controllers/api/v1/compliance_check_sets_controller.rb
index e34d269ee..acb38c834 100644
--- a/app/controllers/api/v1/compliance_check_sets_controller.rb
+++ b/app/controllers/api/v1/compliance_check_sets_controller.rb
@@ -1,6 +1,14 @@
class Api::V1::ComplianceCheckSetsController < Api::V1::IbooController
def validated
@compliance_check_set = ComplianceCheckSet.find(params[:id])
- @compliance_check_set.update_status
+
+ if @compliance_check_set.update_status
+ render :validated
+ else
+ render json: {
+ status: "error",
+ messages: @compliance_check_set.errors.full_messages
+ }
+ end
end
end