Ticket #10733: cache_extension_r8787.diff
| File cache_extension_r8787.diff, 1.7 kB (added by mpalmer, 2 years ago) |
|---|
-
actionpack/lib/action_view/base.rb
old new 158 158 attr_internal :cookies, :flash, :headers, :params, :request, :response, :session 159 159 160 160 attr_writer :template_format 161 attr_accessor :current_render_extension 161 162 162 163 # Specify trim mode for the ERB compiler. Defaults to '-'. 163 164 # See ERb documentation for suitable values. … … 358 359 # The hash in <tt>local_assigns</tt> is made available as local variables. 359 360 def render_template(template_extension, template, file_path = nil, local_assigns = {}) #:nodoc: 360 361 handler = self.class.handler_class_for_extension(template_extension).new(self) 362 @current_render_extension = template_extension 361 363 362 364 if handler.compilable? 363 365 compile_and_render_template(handler, template, file_path, local_assigns) -
actionpack/lib/action_view/helpers/cache_helper.rb
old new 32 32 # <i>Topics listed alphabetically</i> 33 33 # <% end %> 34 34 def cache(name = {}, options = nil, &block) 35 template_extension = @finder.pick_template_extension(first_render)[/\.?(\w+)$/, 1].to_sym 36 handler = Base.handler_class_for_extension(template_extension) 35 handler = Base.handler_class_for_extension(current_render_extension.to_sym) 37 36 handler.new(@controller).cache_fragment(block, name, options) 38 37 end 39 38 end