Sha256: 3c689f4c3d4d4bc86d2390038f71780b5d7cf7e18897739d4b533970d5b68b15

Contents?: true

Size: 467 Bytes

Versions: 35

Compression:

Stored size: 467 Bytes

Contents

module Alchemy
  class Api::BaseController < Alchemy::BaseController
    layout false
    respond_to :json

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

    private

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

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

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
alchemy_cms-3.6.7 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.6.6 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.6.5 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.6.4 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.6.3 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.6.2 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.6.1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-4.0.0.beta app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.6.0 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.5.0 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.4.2 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.5.0.rc2 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.5.0.rc1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.4.1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.3.3 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.3.2 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.4.0 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.4.0.rc1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.3.1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.3.0 app/controllers/alchemy/api/base_controller.rb