Sha256: b3be230322ca8c032cef69621c3ad8e206e9524add90ab9101faac579acb8d50
Contents?: true
Size: 1019 Bytes
Versions: 2
Compression:
Stored size: 1019 Bytes
Contents
module RefinerycmsVarnish module PageExtension def self.included(base) base.after_save :purge_page base.after_destroy :purge_page base.class_eval do private def purge_page if ((self.respond_to?(:title_changed?) and self.title_changed?) or self.link_url_changed?) and self.show_in_menu # it seems that attributes possibly relevant to other pages have changed # -> we expire all urls ActionController::Base.purge "/", true elsif self.link_url and self.link_url.starts_with?("/") # by now we assume that no attributes relevant to other pages have # changed -> we expire this page only ActionController::Base.purge self.link_url else # by now we know that there is no link_url -> we expire this page only ActionController::Base.purge "/#{self.slug.name}" end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
refinerycms-varnish-pages-0.0.2.1 | lib/refinerycms_varnish/page_extension.rb |
refinerycms-varnish-pages-0.0.2 | lib/refinerycms_varnish/page_extension.rb |