Module: Rack::PageCaching::ActionController::ClassMethods

Defined in:
lib/rack/page_caching/action_controller.rb

Instance Method Summary collapse

Instance Method Details

#caches_page(*actions) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# 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