Skip to content

Instantly share code, notes, and snippets.

@dyoder
Created June 13, 2009 20:14
Show Gist options
  • Save dyoder/129417 to your computer and use it in GitHub Desktop.
Save dyoder/129417 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment