0
我有三个models
:STI和PUNDIT - 无法找到政策
class Post < ApplicationRecord
class Diary < Post
class FuturePlans < Post
我也包括在posts_controller.rb
的权威人士:
class BlogsController < ApplicationController
include Pundit
而且我有一个post_policy.rb
:
class BlogPolicy < ApplicationPolicy
class Scope < Scope
def resolve
return scope.all
end
end
我在银行内播种了一些日记和未来计划,包括所有的评论家控制器内的动作,我得到以下错误:
unable to find policy "DiaryPolicy" for "#<Diary id:...
我应该为日记和FuturePlans制定单独的策略吗?我如何让他们继承权威?当我禁用评论者时,它一切正常。
谢谢!