Bap*_* B. 6 ruby ruby-on-rails-3
我尝试安装专家.但是当我设置gem时,我收到了这条消息.
我真的不明白.我是user.admin可能有冲突吗?谢谢您的回答.
sct*_*lsn 10
Pundit为您的控制器添加了一个方法,verify_authorized
用于确保authorize
在控制器操作中的某个位置调用该方法.您可能会设置一个after_action
调用verify_authorized
(https://github.com/elabs/pundit#ensuring-policies-and-scopes-are-used).确保authorize
通过控制器操作调用每个可能的执行路径.
或者,如果您不想授权该特定操作,则可以跳过它:
class PagesControler < ApplicationController
include Pundit
after_action :verify_authorized, except: [:home]
...
end
Run Code Online (Sandbox Code Playgroud)
或者如果您after_action
在继承的控制器中设置:
class ApplicationController < ActionController::Base
include Pundit
after_action :verify_authorized
...
end
class PagesControler < ApplicationController
skip_after_action :verify_authorized, only: [:home]
...
end
Run Code Online (Sandbox Code Playgroud)