Sha256: 57237e092f2943d5cad9939351dcf5ec07092a52e3d1af35c3ba27e77481c632
Contents?: true
Size: 833 Bytes
Versions: 13
Compression:
Stored size: 833 Bytes
Contents
# frozen_string_literal: true class RestrictedAreaController < BaseEditingBootstrap.inherited_controller.constantize include Pundit::Authorization after_action :verify_authorized after_action :verify_policy_scoped, only: :index rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized # :nocov: # Essendo un placeholder per after_action andiamo a non doverlo coprire con il coverage, se viene richiamato fallisce. def index raise "NOT implemented" end # :nocov: private def user_not_authorized(exception) Rails.logger.debug{"Pundit::NotAuthorizedError [#{exception.message}]"} policy_name = exception.policy.class.to_s.underscore flash[:error] = t "#{policy_name}.#{exception.query}", scope: "pundit", default: :default redirect_back(fallback_location: root_path) end end
Version data entries
13 entries across 13 versions & 1 rubygems