Sha256: 02b0541117c583d53a01c136c19a8fd04061dd9419fd1838db17a342a913ef85
Contents?: true
Size: 1.05 KB
Versions: 8
Compression:
Stored size: 1.05 KB
Contents
module Alchemy class ContentSweeper < ActionController::Caching::Sweeper observe Element, Page def after_create(object) expire_contents_displayed_as_select end def after_update(object) if object.class.to_s == "Alchemy::Element" expire_cache_for(object.contents) expire_contents_displayed_as_select elsif object.class.to_s == "Alchemy::Page" && (object.urlname_changed? || object.name_changed?) expire_contents_displayed_as_select end end def after_destroy(object) if object.class.to_s == "Alchemy::Element" expire_cache_for(object.contents) elsif object.class.to_s == "Alchemy::Page" expire_contents_displayed_as_select end end private def expire_cache_for(contents) contents.each do |content| expire_fragment(content) end end # Expires all EssenceSelect content editor cache fragments. def expire_contents_displayed_as_select Content.essence_selects.each { |content| expire_fragment(content) } end end end
Version data entries
8 entries across 8 versions & 1 rubygems