fix error
This commit is contained in:
parent
409fb22fd2
commit
b5bd9f258a
|
@ -10,14 +10,28 @@ class Bulletin
|
|||
include Slug
|
||||
require 'bulletin_model/cache'
|
||||
include BulletinModel::Cache
|
||||
attr_accessor :org_tag_ids
|
||||
attr_accessor :org_tag_ids,:org_category_id
|
||||
def tags=(ids)
|
||||
self.org_tag_ids = self.tag_ids
|
||||
super(ids)
|
||||
end
|
||||
def category=(cat)
|
||||
self.org_category_id = self.category_id
|
||||
super(cat)
|
||||
end
|
||||
def tag_ids=(ids)
|
||||
self.org_tag_ids = self.tag_ids
|
||||
super(ids)
|
||||
end
|
||||
def category_id=(cat_id)
|
||||
self.org_category_id = self.category_id
|
||||
super(cat_id)
|
||||
end
|
||||
def []=(index,value)
|
||||
if index.to_s=='tags'
|
||||
if index.to_s=='tags' || index.to_s=='tag_ids'
|
||||
self.org_tag_ids = self.tag_ids
|
||||
elsif index.to_s=='category' || index.to_s=='category_id'
|
||||
self.org_category_id = self.category_id
|
||||
end
|
||||
super(index,value)
|
||||
end
|
||||
|
|
|
@ -12,8 +12,9 @@ module BulletinModel
|
|||
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
|
||||
tmp_cat_ids = (Array(self.category_id) + Array(self.org_category_id)).uniq
|
||||
Thread.new do
|
||||
BulletinFeedCache.where(:uid.in => BulletinFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).each do |cache|
|
||||
BulletinFeedCache.where(:uid.in => BulletinFeed.any_of([{:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}},{:category_ids.in => tmp_cat_ids.collect{|v| v.to_s}}]).pluck(:uid)).each do |cache|
|
||||
cache.regenerate
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue