class CompanySweeper < ActionController::Caching::Sweeper observe Company, Comment, Document, Order, Trade %w( create update destroy ).each do | action | define_method( "after_#{action}") do | instance | %w( index companies/* pages/home ).each { |p| `rm -rf public/cache/views/#{p}.html.cache` } end end end