evodata/app/controllers/application_controller.rb

14 lines
334 B
Ruby

class ApplicationController < ActionController::Base
include BasicAuthentication
include Pundit
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
private
def user_not_authorized
flash[:alert] = "You are not authorized to perform this action."
redirect_to(request.referrer || root_path)
end
end