2017-08-07 10 views
0

を見つけることができない私は3 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のための個別のポリシーを作成する必要がありますか?私はどのようにして彼らにも専門家を継承させるのですか?私が専門家を無効にするとき、それはすべて働く。

ありがとうございます!

答えて

0

私はDiaryPolicyとFuturePlansPolicyを作成しました。これは再び動作します。