diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-30 22:31:16 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-30 22:31:16 +0200 |
commit | 96ad9b0db140d392ffcab0840d49897ed3f0af7a (patch) | |
tree | cbd1094b43f2bcf2513bc258ded1e7c24a84880f /app | |
parent | 62b057b085ea7ff20765731d64a79e38f19174d4 (diff) |
Meaningful validation errors in API response
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index e3ac9fc67..c550b38e8 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -2,8 +2,8 @@ class ApiController < ApplicationController protect_from_forgery with: :null_session skip_before_action :verify_authenticity_token - rescue_from ActiveRecord::RecordInvalid do - render json: { error: 'Record invalid' }, status: 422 + rescue_from ActiveRecord::RecordInvalid do |e| + render json: { error: e.to_s }, status: 422 end rescue_from ActiveRecord::RecordNotFound do |