From 68d3a4619490a0d9df1951f38068bd06d9e0fbb9 Mon Sep 17 00:00:00 2001 From: Chris Kelly Date: Mon, 20 Feb 2012 14:35:30 -0500 Subject: Reset memoized hash keys when new entry added --- actionpack/lib/action_view/template/handlers.rb | 1 + actionpack/test/template/render_test.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/actionpack/lib/action_view/template/handlers.rb b/actionpack/lib/action_view/template/handlers.rb index aa693335e3..192e527a7b 100644 --- a/actionpack/lib/action_view/template/handlers.rb +++ b/actionpack/lib/action_view/template/handlers.rb @@ -26,6 +26,7 @@ module ActionView #:nodoc: # return the rendered template as a string. def register_template_handler(extension, klass) @@template_handlers[extension.to_sym] = klass + @@template_extensions = nil end def template_handler_extensions diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index b1a866b148..893c3498e8 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -329,6 +329,12 @@ module RenderTestCases ActionView::Template.register_template_handler :foo, CustomHandler assert_equal 'source: "Hello, <%= name %>!"', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo) end + + def test_render_knows_about_types_registered_when_extensions_are_checked_earlier_in_initialization + ActionView::Template::Handlers.extensions + ActionView::Template.register_template_handler :foo, CustomHandler + assert ActionView::Template::Handlers.extensions.include?(:foo) + end def test_render_ignores_templates_with_malformed_template_handlers ActiveSupport::Deprecation.silence do -- cgit v1.2.3