Skip to content

Instantly share code, notes, and snippets.

@overture8
Created October 2, 2009 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save overture8/200213 to your computer and use it in GitHub Desktop.
Save overture8/200213 to your computer and use it in GitHub Desktop.
class PersonSweeper < ActionController::Caching::Sweeper
observe Person
def after_create(person)
expire_cache_for person
end
def after_update(person)
expire_cache_for person
end
def after_destroy(person)
expire_cache_for person
end
private
def expire_cache_for(person)
expire_page :action => :index
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment