Class: ActionController::Caching::Actions::ActionCacheFilter
- Defined in:
- lib/action_controller/caching.rb
Overview
:nodoc:
Instance Method Summary collapse
- #after(controller) ⇒ Object
- #before(controller) ⇒ Object
-
#initialize(*actions) ⇒ ActionCacheFilter
constructor
A new instance of ActionCacheFilter.
Constructor Details
#initialize(*actions) ⇒ ActionCacheFilter
Returns a new instance of ActionCacheFilter.
171 172 173 |
# File 'lib/action_controller/caching.rb', line 171 def initialize(*actions) @actions = actions end |
Instance Method Details
#after(controller) ⇒ Object
184 185 186 187 |
# File 'lib/action_controller/caching.rb', line 184 def after(controller) return if !@actions.include?(controller.action_name.intern) || controller.rendered_action_cache controller.write_fragment(controller.url_for.split("://").last, controller.response.body) end |
#before(controller) ⇒ Object
175 176 177 178 179 180 181 182 |
# File 'lib/action_controller/caching.rb', line 175 def before(controller) return unless @actions.include?(controller.action_name.intern) if cache = controller.read_fragment(controller.url_for.split("://").last) controller.rendered_action_cache = true controller.send(:render_text, cache) false end end |