Module: Immunio::FragmentCachingHooks
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/immunio/plugins/action_view.rb
Overview
Hook for ‘ActionController::Caching::Fragments` responsible for handling the `<% cache do %>…` in templates.
Instance Method Summary collapse
Instance Method Details
#write_fragment_with_immunio(key, content, options = nil) ⇒ Object
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/immunio/plugins/action_view.rb', line 430 def write_fragment_with_immunio(key, content, = nil) return content unless cache_configured? template = Template.current if template # We're rendering a template. Defer caching 'till we get the escaped content from the hook handler. content = Template.mark_and_defer_fragment_write(key, content, ) else # Not rendering a template. Ignore. # Shouldn't happen. But, just to be safe in case fragment caching is used in the controller for something else. content = write_fragment_without_immunio(key, content, ) end content end |