您必须使用RestaurantPolicy :: Scope定义策略方法,如下所示:
class RestaurantPolicy < ApplicationPolicy class Scope < Scope def index? true end end # Notice we have closed the definition of Scope class. def show? scope.where(:id => record.id).exists? end def create? true end def new? create? end def update? true end def edit? update? end def destroy? true end end