class ApplicationController < ActionController::Base include Pundit::Authorization alias :current_user :current_member #for pundit rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized protected def user_not_authorized flash[:alert] = "You are not authorized to perform this action." redirect_back(fallback_location: root_path) end end