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
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/immunio/plugins/action_view.rb', line 495 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 |