# Sweeper for few models

**URL:** <https://www.ruby-forum.com/t/sweeper-for-few-models/118171>\
**Category:** Rails\
**Created:** [October 24, 2007, 2:04pm UTC](https://www.ruby-forum.com/t/sweeper-for-few-models/118171 "2007-10-24T14:04:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 24, 2007, 2:04pm UTC](https://www.ruby-forum.com/t/sweeper-for-few-models/118171/1 "2007-10-24T14:04:35Z")

</div>

For example - i have a sweeper for one model(in this case About).  
class AboutSweeper \< ActionController::Caching::Sweeper  
observe About  
def after\_create(data)  
expire\_about(data)  
end  
def after\_save(data)  
expire\_about(data)  
end  
def after\_destroy(data)  
expire\_about(data)  
end  
def expire\_about(data)  
FileUtils.rm\_rf File.expand\_path(“public/about/#{data.id}”,  
RAILS\_ROOT)  
FileUtils.rm\_rf File.expand\_path(“public/index.html”, RAILS\_ROOT)  
end  
end

But I want to use one sweeper for several models. Can I write  
something like  
observer About, Book, Shop, City…  
And expire this pages when i need? Or I need to create personal  
sweeper for model?

Thanks
