aboutsummaryrefslogblamecommitdiffstats
path: root/app/sweepers/refinery/blog_sweeper.rb
blob: a58ac7ec85ff78269525267c1f41090f523aac6a (plain) (tree)
1
2
3
4
5
6
7
8

                                                        

                                     


                              
 


                              
 


                              
 
           
 
                                  


                                            
         
 

     
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