aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-02-20 11:48:14 -0800
committerJosé Valim <jose.valim@gmail.com>2012-02-20 20:49:39 +0100
commit5e3b54d25aeb84c4d6806416fbd6c21c29564d6a (patch)
treefd1a9a5065d6722061f62875d51d144feeaf6fa1
parent07dc909a47b644a9fe841ceaa6234fd8abac94c6 (diff)
downloadrails-5e3b54d25aeb84c4d6806416fbd6c21c29564d6a.tar.gz
rails-5e3b54d25aeb84c4d6806416fbd6c21c29564d6a.tar.bz2
rails-5e3b54d25aeb84c4d6806416fbd6c21c29564d6a.zip
Merge pull request #5101 from ckdake/ckdake_actionview_handler_reset
Reset memoized hash keys when new ActionView::Template handler is registered Conflicts: actionpack/lib/action_view/template/handlers.rb
-rw-r--r--actionpack/lib/action_view/template/handlers.rb1
-rw-r--r--actionpack/test/template/render_test.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template/handlers.rb b/actionpack/lib/action_view/template/handlers.rb
index 67978ada7e..4e22bec6cc 100644
--- a/actionpack/lib/action_view/template/handlers.rb
+++ b/actionpack/lib/action_view/template/handlers.rb
@@ -23,6 +23,7 @@ module ActionView #:nodoc:
# and should return the rendered template as a String.
def register_template_handler(extension, handler)
@@template_handlers[extension.to_sym] = handler
+ @@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 5d3dc73ed2..788ad61356 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -299,6 +299,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