class ApplicationPolicy attr_reader :user, :record def initialize(user, record) @user = user @record = record end def index? true end def show? scope.where(id: record.id).exists? end def create? true end def new? true end def update? true end def edit? true end def destroy? @user.master? end def scope Pundit.policy_scope!(user, record.class) end end