Module: TemplateStreaming::Caching::ActionCacheFilter

Defined in:
lib/template_streaming/caching.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



45
46
47
# File 'lib/template_streaming/caching.rb', line 45

def self.included(base)
  base.alias_method_chain :after, :template_streaming_caching
end

Instance Method Details

#after_with_template_streaming_caching(controller) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/template_streaming/caching.rb', line 49

def after_with_template_streaming_caching(controller)
  if controller.streaming_template?
    # This flag is ass-backwards to me. It really means *don't* cache the layout...
    cache_layout? and
      raise NotImplementedError, "sorry, using caches_action with :layout => false is not yet supported by Template Streaming"
    controller.request.env[CACHER_KEY] = lambda do |content|
      # This is what the standard method does.
      controller.write_fragment(controller.action_cache_path.path, content, @options[:store_options])
    end
  else
    after_without_template_streaming_caching(controller)
  end
end