Sha256: eb5c58a3e7adb181ebd1f6dec534ba3c5b75ad621b9f1b58a4fe56e89591de29

Contents?: true

Size: 394 Bytes

Versions: 2

Compression:

Stored size: 394 Bytes

Contents

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

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