我已经在我的应用程序中添加了配置pundit适配器授权。
当我使用admin@example.com的凭据登录时,我遇到了这个错误。
我创建了这些文件在我的policies/active_admin文件夹中。
adminuser_policy.rb
我缺少什么?谢谢你的帮助!
config.authorization_adapter = ActiveAdmin::PunditAdapter
当我使用admin@example.com的凭据登录时,我遇到了这个错误。
Pundit::NotDefinedError in Admin::Dashboard#index
unable to find policy AdminUserPolicy
Extracted source (around line #2):
insert_tag active_admin_application.view_factory["page"]
我创建了这些文件在我的policies/active_admin文件夹中。
adminuser_policy.rb
module ActiveAdmin
class AdminUserPolicy < ApplicationPolicy
class Scope < Struct.new(:user, :scope)
def resolve
scope
end
end
def home?
true
end
def index?
true
end
def show?
true
end
def new?
true
end
def create?
true
end
def update?
true
end
def destroy?
true
end
end
end
page_policy.rb
module ActiveAdmin
class PagePolicy < ApplicationPolicy
class Scope < Struct.new(:user, :scope)
def resolve
scope
end
end
def index?
true
end
def show?
true
end
end
end
我缺少什么?谢谢你的帮助!