class Api::BaseApiController
Public Instance Methods
respond_with_errors(object)
click to toggle source
# File lib/voyage/templates/api_base_controller.rb, line 12 def respond_with_errors(object) serialized_errors = object.errors.messages.map do |field, errors| errors.map do |error_message| { status: 422, source: { pointer: "/data/attributes/#{field}" }, detail: error_message, } end end.flatten render json: { errors: serialized_errors }, status: :unprocessable_entity end
Private Instance Methods
destroy_session()
click to toggle source
# File lib/voyage/templates/api_base_controller.rb, line 29 def destroy_session request.session_options[:skip] = true end
not_found()
click to toggle source
# File lib/voyage/templates/api_base_controller.rb, line 33 def not_found render json: { errors: 'Not found' }, status: 404 end