module Lipstick::DynamicErrors

Constants

BadRequest
Forbidden
NotFound
Unauthorized

Public Class Methods

included(base) click to toggle source
# File lib/lipstick/errors/dynamic_errors.rb, line 20
def self.included(base)
  base.rescue_from Forbidden, with: :forbidden
  base.rescue_from Unauthorized, with: :unauthorized
  base.rescue_from BadRequest, with: :bad_request
  base.rescue_from NotFound, with: :not_found
  base.rescue_from(::ActiveRecord::RecordNotFound, with: :not_found)
end

Private Instance Methods

bad_request() click to toggle source
# File lib/lipstick/errors/dynamic_errors.rb, line 49
def bad_request
  render 'dynamic_errors/bad_request',
         status: :bad_request,
         layout: 'application'
end
forbidden() click to toggle source
# File lib/lipstick/errors/dynamic_errors.rb, line 43
def forbidden
  render 'dynamic_errors/forbidden',
         status: :forbidden,
         layout: 'application'
end
not_found() click to toggle source
# File lib/lipstick/errors/dynamic_errors.rb, line 30
def not_found
  render 'dynamic_errors/not_found',
         status: :not_found,
         layout: 'application'
end
unauthorized() click to toggle source
# File lib/lipstick/errors/dynamic_errors.rb, line 36
def unauthorized
  reset_session
  render 'dynamic_errors/unauthorized',
         status: :unauthorized,
         layout: 'application'
end