Sha256: 94d674a4dd200836ebcda60b0d6f352257c3c9858c20ed218b44e9ae4107373e

Contents?: true

Size: 424 Bytes

Versions: 2

Compression:

Stored size: 424 Bytes

Contents

class SlightcmsPageElementSweeper < ActionController::Caching::Sweeper
  
  observe SlightcmsPageElement
  
  def after_save(element)   
    expire_cache(element)
  end
  
  def after_destroy(element)
    expire_cache(element)
  end
  
  private
  
  # Expire page cache for given record
  def expire_cache(record)
    expire_page(:controller => :slightcms_pages, :action => :show, :path => record.page.full_path)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slightcms-0.0.2 lib/slightcms/slightcms_page_element_sweeper.rb
slightcms-0.0.1 lib/slightcms/slightcms_page_element_sweeper.rb