module ActionController::Caching::Pages::ClassMethods
def caches_page(*actions)
# don't gzip images
caches_page :index, :if => Proc.new { |c| !c.request.format.json? }
# cache the index action except for JSON requests
caches_page :index
# cache the index action
Usage:
You can also pass a :gzip option to override the class configuration one.
matches the triggering url.
the cache in a path within the page_cache_directory that
Caches the +actions+ using the page-caching approach that'll store
def caches_page(*actions) return unless perform_caching options = actions.extract_options! gzip_level = options.fetch(:gzip, page_cache_compression) gzip_level = case gzip_level when Symbol Zlib.const_get(gzip_level.to_s.upcase) when Fixnum gzip_level when false nil else Zlib::BEST_COMPRESSION end after_filter({:only => actions}.merge(options)) do |c| c.cache_page(nil, nil, gzip_level) end end