fix feed cache error
This commit is contained in:
parent
aca4818b7b
commit
53c5d91035
|
@ -10,6 +10,17 @@ class Bulletin
|
||||||
include Slug
|
include Slug
|
||||||
require 'bulletin_model/cache'
|
require 'bulletin_model/cache'
|
||||||
include BulletinModel::Cache
|
include BulletinModel::Cache
|
||||||
|
attr_accessor :org_tag_ids
|
||||||
|
def tags=(ids)
|
||||||
|
self.org_tag_ids = self.tag_ids
|
||||||
|
super(ids)
|
||||||
|
end
|
||||||
|
def []=(index,value)
|
||||||
|
if index.to_s=='tags'
|
||||||
|
self.org_tag_ids = self.tag_ids
|
||||||
|
end
|
||||||
|
super(index,value)
|
||||||
|
end
|
||||||
SubPart.class_eval { include BulletinModel::Cache }
|
SubPart.class_eval { include BulletinModel::Cache }
|
||||||
Page.class_eval { include BulletinModel::Cache }
|
Page.class_eval { include BulletinModel::Cache }
|
||||||
before_destroy do
|
before_destroy do
|
||||||
|
|
|
@ -10,7 +10,7 @@ module BulletinModel
|
||||||
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(Bulletin.find(self.id).tag_ids)).uniq
|
tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq
|
||||||
BulletinFeedCache.where(:uid.in => BulletinFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).destroy
|
BulletinFeedCache.where(:uid.in => BulletinFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).destroy
|
||||||
end
|
end
|
||||||
AnnsCache.all.destroy
|
AnnsCache.all.destroy
|
||||||
|
|
Loading…
Reference in New Issue