module Rack::PageCaching::ActionController::ClassMethods

Public Instance Methods

caches_page(*actions) click to toggle source
# File lib/rack/page_caching/action_controller.rb, line 7
def caches_page(*actions)
  return unless perform_caching
  options = actions.extract_options!
  gzip_level = options.fetch(:gzip, Zlib::BEST_COMPRESSION)
  gzip_level = Rack::PageCaching::Utils.gzip_level(gzip_level)
  after_filter({ only: actions }.merge(options)) do |c|
    c.request.env['rack.page_caching.perform_caching'] = true
    c.request.env['rack.page_caching.compression'] = gzip_level
  end
end