aboutsummaryrefslogtreecommitdiffstats
path: root/app/sweepers/refinery/blog_sweeper.rb
blob: a58ac7ec85ff78269525267c1f41090f523aac6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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