Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix missing extension for caching. Closes #10733 [Catfish, tcoppock, …

…mpalmer]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8791 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 780151c01e7e2d953f2701c2b931a1b33e4b88ca 1 parent 78253ac
@jeremy jeremy authored
View
2  actionpack/lib/action_view/base.rb
@@ -158,6 +158,7 @@ class Base
attr_internal :cookies, :flash, :headers, :params, :request, :response, :session
attr_writer :template_format
+ attr_accessor :current_render_extension
# Specify trim mode for the ERB compiler. Defaults to '-'.
# See ERb documentation for suitable values.
@@ -358,6 +359,7 @@ def render(options = {}, old_local_assigns = {}, &block) #:nodoc:
# The hash in <tt>local_assigns</tt> is made available as local variables.
def render_template(template_extension, template, file_path = nil, local_assigns = {}) #:nodoc:
handler = self.class.handler_class_for_extension(template_extension).new(self)
+ @current_render_extension = template_extension
if handler.compilable?
compile_and_render_template(handler, template, file_path, local_assigns)
View
3  actionpack/lib/action_view/helpers/cache_helper.rb
@@ -32,8 +32,7 @@ module CacheHelper
# <i>Topics listed alphabetically</i>
# <% end %>
def cache(name = {}, options = nil, &block)
- template_extension = @finder.pick_template_extension(first_render)[/\.?(\w+)$/, 1].to_sym
- handler = Base.handler_class_for_extension(template_extension)
+ handler = Base.handler_class_for_extension(current_render_extension.to_sym)
handler.new(@controller).cache_fragment(block, name, options)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.