我想跳过Pundit 在一个控制器(家庭)上的policy_scope要求。我试过这个:
class ApplicationController < ActionController::Base
include Pundit
after_action :verify_authorized, :except => :index, unless: :devise_controller?
after_action :verify_policy_scoped, :only => :index, unless: controller.controller_name == "home"
end
class HomeController < ApplicationController
def index
redirect_to (new_user_session_path) unless user_signed_in?
if user_signed_in?
@user=current_user
end
end
end
但我认为控制器尚未定义或什么?有什么想法或建议吗?