From e28b785a41335c75fea8fcd9b9a6a2a6483ef4b0 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Mon, 6 Mar 2023 10:43:31 +0800 Subject: [PATCH] Fix bug. --- lib/event_news_model/cache.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/event_news_model/cache.rb b/lib/event_news_model/cache.rb index bdd13b9..e1b0492 100644 --- a/lib/event_news_model/cache.rb +++ b/lib/event_news_model/cache.rb @@ -7,17 +7,17 @@ module EventNewsModel end def do_before_save if self.class == SubPart - EventNewsCache.where(parent_id:self.id).destroy - elsif self.class == EventNews || (self.class == Page && self.module == "event_news") - if self.class == EventNews + ::EventNewsCache.where(parent_id:self.id).destroy + elsif self.class == ::EventNews || (self.class == Page && self.module == "event_news") + if self.class == ::EventNews tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq Thread.new do - EventNewsCache.where(:uid.in => EventNewsFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).each do |cache| + ::EventNewsCache.where(:uid.in => ::EventNewsFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).each do |cache| cache.regenerate end end end - EventNewsCache.all.destroy + ::EventNewsCache.all.destroy end end end