16 lines
436 B
Ruby
16 lines
436 B
Ruby
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 |