Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10733: cache_extension_r8787.diff

File cache_extension_r8787.diff, 1.7 kB (added by mpalmer, 2 years ago)

Update of tcoppock's patch against r8787

  • actionpack/lib/action_view/base.rb

    old new  
    158158    attr_internal :cookies, :flash, :headers, :params, :request, :response, :session 
    159159     
    160160    attr_writer :template_format 
     161    attr_accessor :current_render_extension 
    161162 
    162163    # Specify trim mode for the ERB compiler. Defaults to '-'. 
    163164    # See ERb documentation for suitable values. 
     
    358359    # The hash in <tt>local_assigns</tt> is made available as local variables. 
    359360    def render_template(template_extension, template, file_path = nil, local_assigns = {}) #:nodoc: 
    360361      handler = self.class.handler_class_for_extension(template_extension).new(self) 
     362      @current_render_extension = template_extension 
    361363 
    362364      if handler.compilable? 
    363365        compile_and_render_template(handler, template, file_path, local_assigns) 
  • actionpack/lib/action_view/helpers/cache_helper.rb

    old new  
    3232      #      <i>Topics listed alphabetically</i> 
    3333      #    <% end %> 
    3434      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) 
    3736        handler.new(@controller).cache_fragment(block, name, options) 
    3837      end 
    3938    end