From d6593427f3ec27beab6e693339d679202067f54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Tue, 29 Mar 2022 16:41:21 +0800 Subject: [PATCH] fix error --- app/controllers/admin/announcements_controller.rb | 1 + lib/bulletin_model/cache.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/announcements_controller.rb b/app/controllers/admin/announcements_controller.rb index 4ab867b..e6cfcbc 100644 --- a/app/controllers/admin/announcements_controller.rb +++ b/app/controllers/admin/announcements_controller.rb @@ -19,6 +19,7 @@ class Admin::AnnouncementsController < OrbitAdminController ids.each_with_index do |id,i| Bulletin.where(id: id).update(sort_number: i) end + AnnsCache.all.delete edit_sort render 'update_sort',layout: false diff --git a/lib/bulletin_model/cache.rb b/lib/bulletin_model/cache.rb index 4c49880..7faab2c 100644 --- a/lib/bulletin_model/cache.rb +++ b/lib/bulletin_model/cache.rb @@ -8,7 +8,7 @@ module BulletinModel end def do_before_save if self.class == SubPart - AnnsCache.where(parent_id: self.id).destroy + AnnsCache.where(parent_id: self.id).delete elsif self.class == Bulletin || (self.class == Page && self.module == "announcement") if self.class == Bulletin tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq @@ -19,7 +19,7 @@ module BulletinModel end end end - AnnsCache.all.destroy + AnnsCache.all.delete end end end