diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers/cache_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/cache_helper.rb | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index 783a5acdbc..059f2edf0f 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -33,23 +33,8 @@ module ActionView # <% end %> def cache(name = {}, options = nil, &block) template_extension = find_template_extension_for(first_render)[/\.(\w+)$/, 1].to_sym - - case template_extension - when :erb, :rhtml - @controller.cache_erb_fragment(block, name, options) - when :rjs - @controller.cache_rjs_fragment(block, name, options) - when :builder, :rxml - @controller.cache_rxml_fragment(block, name, options) - else - # Give template engine writers a hook to implement their own caching approach - if @controller.respond_to?("cache_#{template_extension}_fragment") - @controller.send!("cache_#{template_extension}_fragment", block, name, options) - else - # Let the ERb approach be the default one if the plugin doesn't specify it's own - @controller.cache_erb_fragment(block, name, options) - end - end + handler = Base.handler_for_extension(template_extension) + handler.new(@controller).cache_fragment(block, name, options) end end end |