Browse Source

Meaningful validation errors in API response

closed-social-glitch-2
Eugen Rochko 7 years ago
parent
commit
96ad9b0db1
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      app/controllers/api_controller.rb

+ 2
- 2
app/controllers/api_controller.rb View File

@ -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

Loading…
Cancel
Save