diff options
Diffstat (limited to 'app/sweepers/refinery/blog_sweeper.rb')
-rw-r--r-- | app/sweepers/refinery/blog_sweeper.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/sweepers/refinery/blog_sweeper.rb b/app/sweepers/refinery/blog_sweeper.rb new file mode 100644 index 0000000..a58ac7e --- /dev/null +++ b/app/sweepers/refinery/blog_sweeper.rb @@ -0,0 +1,26 @@ +module Refinery + class BlogSweeper < ActionController::Caching::Sweeper + observe Blog::Post, Blog::Comment + + def after_create(record) + expire_cache_for(record) + end + + def after_update(record) + expire_cache_for(record) + end + + def after_destroy(record) + expire_cache_for(record) + end + + private + + def expire_cache_for(record) + # TODO: Convert these to url helpers + expire_page '/blog' + expire_page '/blog/feed.rss' + end + + end +end |