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.3.0.rc2 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.3.0.rc1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.2.1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.1.3 app/controllers/alchemy/api/base_controller.rb
lc_alchemy_cms-3.2.1 app/controllers/alchemy/api/base_controller.rb
lc_alchemy_cms-3.2.0 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.2.0 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.2.0.rc1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.2.0.beta app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.1.1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.1.0 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.1.0.rc3 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.1.0.rc2 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.1.0.rc1 app/controllers/alchemy/api/base_controller.rb
alchemy_cms-3.1.0.beta6 app/controllers/alchemy/api/base_controller.rb