Skip to content

Commit

Permalink
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/alchemy/api/base_controller.rb
Original file line number Diff line number Diff line change
@@ -5,18 +5,18 @@ class Api::BaseController < Alchemy::BaseController
layout false
respond_to :json

rescue_from CanCan::AccessDenied, with: :render_not_authorized
rescue_from CanCan::AccessDenied, with: :render_not_authorized
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
rescue_from ActionController::RoutingError, with: :render_not_found

private

def render_not_authorized
render json: {error: "Not authorized"}, status: 403
render json: { error: "Not authorized" }, status: 403
end

def render_not_found
render json: {error: "Record not found"}, status: 404
render json: { error: "Record not found" }, status: 404
end
end
end

0 comments on commit c14f65d

Please sign in to comment.