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 new? create? end def create? true end def edit? update? end def update? true end def destroy? true end def destroy_all? true end def scope Pundit.policy_scope!(user, record.class) end end