app/controllers/application_controller.rb
# Render a JSON error with the given error message and status code.
# Accepts parameters in either order for legacy reasons.
# Advised parameter order is status, message
Render a JSON error with the given error message and status code.
Accepts parameters in either order for legacy reasons.
Advised parameter order is status, message
Render a JSON error with the given error message and status code . Accepts parameters in either order for legacy reasons . Advised parameter order is status message
def error!(status, message)
    status, message = message, status unless status.is_a?(Fixnum)
    if message.is_a?(Hash)
      render json: { errors: message }, status: status
    else
      render json: { error: message }, status: status
    end
  end
def error! ( status , message ) status , message = message , status unless status . is_a? ( Fixnum ) if message . is_a? ( Hash ) render json : { errors : message } , status : status else render json : { error : message } , status : status end end
Render a JSON error with the given error message and status code.
Render a JSON error with the given error message and status code .
# Flip the params if status isn't a number # If the message is a Hash of errors, we put it in standard ED form
status
<not_specific>
message
<not_specific>