class EpisodeSweeper < ActionController::Caching::Sweeper observe Episode def after_create(record) expire_episode(record) end def after_save(record) expire_episode(record) end def after_destroy(record) expire_episode(record) end def expire_episode(record) FileUtils.rm_rf File.expand_path("public/programs/#{record.program_id}", RAILS_ROOT) FileUtils.rm_rf File.expand_path("public/index.html", RAILS_ROOT) end end