Permalink
Browse files

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
  • Loading branch information...
1 parent 07dc909 commit 5e3b54d25aeb84c4d6806416fbd6c21c29564d6a @josevalim josevalim committed Feb 20, 2012
Showing with 7 additions and 0 deletions.
  1. +1 −0 actionpack/lib/action_view/template/handlers.rb
  2. +6 −0 actionpack/test/template/render_test.rb
@@ -23,6 +23,7 @@ def self.extensions
# 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
@@ -299,6 +299,12 @@ def test_render_inline_with_locals_and_compilable_custom_type
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

0 comments on commit 5e3b54d

Please sign in to comment.