igorkasyanchuk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Oct-24 12:03 UTC
Sweeper for few models
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---