From bd230ddd801587ae097ccca8ba3f027c6df7b91f Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Mon, 9 May 2016 15:01:12 -0500 Subject: [PATCH] Actually helpful registration errors --- .ruby-version | 2 +- app/controllers/api/abstract_controller.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 585940699..2bf1c1ccf 100755 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.2.3 +2.3.1 diff --git a/app/controllers/api/abstract_controller.rb b/app/controllers/api/abstract_controller.rb index d8295263e..23077358b 100644 --- a/app/controllers/api/abstract_controller.rb +++ b/app/controllers/api/abstract_controller.rb @@ -20,6 +20,11 @@ module Api 'schedule_id, sequence_id, id, etc..', 400 end + + rescue_from Mongoid::Errors::Validations do |exc| + render json: {error: exc.summary}, status: 422 + end + private def current_device