announcement-test/lib/bulletin_model/cache.rb

16 lines
419 B
Ruby
Raw Permalink Normal View History

module BulletinModel
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
AnnsCache.where(parent_id:self.id).destroy
elsif self.class == Bulletin || (self.class == Page && self.module == "announcement")
AnnsCache.all.destroy
end
end
end
end