event_ann/lib/event_bulletin_model/cache.rb

16 lines
436 B
Ruby
Raw Permalink Normal View History

2020-07-13 08:04:57 +00:00
module EventBulletinModel
module Cache
require 'active_support/concern'
extend ActiveSupport::Concern
included do
before_save :do_before_save
end
def do_before_save
if self.class == SubPart
EventAnnsCache.where(parent_id:self.id).destroy
elsif self.class == BulletinEvent || (self.class == Page && self.module == "event_ann")
EventAnnsCache.all.destroy
end
end
end
end