3a78ef3dbf
If a Web has categories defined, you can delete orphaned pages in a given category (in addition to being able to delete all orphaned pages).
24 lines
480 B
Ruby
24 lines
480 B
Ruby
require_dependency 'cache_sweeping_helper'
|
|
|
|
class WebSweeper < ActionController::Caching::Sweeper
|
|
|
|
include CacheSweepingHelper
|
|
|
|
observe Web
|
|
|
|
def after_save(record)
|
|
web = record
|
|
web.pages.each { |page| expire_cached_page(web, page.name) }
|
|
expire_cached_summary_pages(web)
|
|
end
|
|
|
|
def after_remove_orphaned_pages(web)
|
|
expire_cached_summary_pages(web)
|
|
end
|
|
|
|
def after_remove_orphaned_pages_in_category(web)
|
|
expire_cached_summary_pages(web)
|
|
end
|
|
|
|
end
|