fix error

This commit is contained in:
邱博亞 2022-02-08 15:45:06 +08:00
parent 21bb599442
commit 409fb22fd2
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ class Bulletin
include OrbitCategory::Categorizable include OrbitCategory::Categorizable
include Slug include Slug
require 'bulletin_model/cache' require 'bulletin_model/cache'
include ::BulletinModel::Cache include BulletinModel::Cache
attr_accessor :org_tag_ids attr_accessor :org_tag_ids
def tags=(ids) def tags=(ids)
self.org_tag_ids = self.tag_ids self.org_tag_ids = self.tag_ids

View File

@ -3,12 +3,12 @@ module BulletinModel
require 'active_support/concern' require 'active_support/concern'
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
before_save :do_before_save after_save :do_before_save
before_destroy :do_before_save after_destroy :do_before_save
end end
def do_before_save def do_before_save
if self.class == SubPart if self.class == SubPart
AnnsCache.where(parent_id:self.id).destroy AnnsCache.where(parent_id: self.id).destroy
elsif self.class == Bulletin || (self.class == Page && self.module == "announcement") elsif self.class == Bulletin || (self.class == Page && self.module == "announcement")
if self.class == Bulletin if self.class == Bulletin
tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq