我有三个models
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我在一些日记和未来计划中植入了bankseed,在控制器内部的所有操作中都包含了pundit,我得到了以下错误:
unable to find policy "DiaryPolicy" for "#<Diary id:...我应该为日记和FuturePlans制定单独的政策吗?我如何让他们也继承权威呢?当我禁用pundit时,一切都正常。
谢谢!
发布于 2017-08-14 07:38:54
我创建了DiaryPolicy和FuturePlansPolicy,现在它又可以工作了。
https://stackoverflow.com/questions/45547876
复制相似问题