Sha256: 518412d0d104e1b62ed76f9636f46784e274bdc28c8bff21e60ec1600fc4b097
Contents?: true
Size: 798 Bytes
Versions: 4
Compression:
Stored size: 798 Bytes
Contents
class ApplicationController < ActionController::Base include Pundit protect_from_forgery with: :exception before_action :authenticate_user!, unless: :pages_controller? after_action :verify_authorized, except: :index, unless: :devise_or_pages_controller? after_action :verify_policy_scoped, only: :index, unless: :devise_or_pages_controller? rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized private def devise_or_pages_controller? devise_controller? || pages_controller? end def pages_controller? controller_name == "pages" # Brought by the `high_voltage` gem end def user_not_authorized flash[:error] = I18n.t('controllers.application.user_not_authorized', default: "You can't access this page.") redirect_to(root_path) end end
Version data entries
4 entries across 4 versions & 1 rubygems