Sha256: 55d95d74d0fd9ffa51f753a914c2e983858764c76bc4c627a6ae8f21528b85ad
Contents?: true
Size: 598 Bytes
Versions: 15
Compression:
Stored size: 598 Bytes
Contents
require 'pundit' # config/initializers/pundit.rb # Extends the ApplicationController to add Pundit for authorization. # Modify this file to change the behavior of a 'not authorized' error. # Be sure to restart your server when you modify this file. module PunditHelper extend ActiveSupport::Concern included do include Pundit rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized end private def user_not_authorized flash[:alert] = t(:access_denied) redirect_to (request.referrer || root_path) end end ApplicationController.send :include, PunditHelper
Version data entries
15 entries across 15 versions & 1 rubygems