Module: ActionController::Caching::Actions::ClassMethods

Defined in:
lib/action_controller/caching/actions.rb

Instance Method Summary collapse

Instance Method Details

#caches_action(*actions) ⇒ Object

Declares that actions should be cached. See ActionController::Caching::Actions for details.



109
110
111
112
113
114
115
116
117
# File 'lib/action_controller/caching/actions.rb', line 109

def caches_action(*actions)
  return unless cache_configured?
  options = actions.extract_options!
  options[:layout] = true unless options.key?(:layout)
  filter_options = options.extract!(:if, :unless).merge(only: actions)
  cache_options  = options.extract!(:layout, :cache_path).merge(store_options: options)

  around_action ActionCacheFilter.new(cache_options), filter_options
end