Sha256: 1af9842d251b55fa5bb0cb2686f645400901a90f1f97bcf31628b5cdc1dcf438
Contents?: true
Size: 757 Bytes
Versions: 18
Compression:
Stored size: 757 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) 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
18 entries across 18 versions & 1 rubygems