Skip to content
This repository
Browse code

ActionView: Allow to register a Template handler with a Symbol (dont …

…kill markaby) (closes #4328) [murphy@cYcnus.de]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4056 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 0c07e08d60ddfe4f6ed3aea66b6c4dc8f88e379a 1 parent 1886de8
David Heinemeier Hansson authored March 26, 2006
2  actionpack/lib/action_view/base.rb
@@ -168,7 +168,7 @@ class Base
168 168
     @@debug_rjs = false
169 169
     cattr_accessor :debug_rjs
170 170
 
171  
-    @@template_handlers = {}
  171
+    @@template_handlers = HashWithIndifferentAccess.new
172 172
  
173 173
     module CompiledTemplates #:nodoc:
174 174
       # holds compiled template code
8  actionpack/test/controller/custom_handler_test.rb
@@ -15,6 +15,7 @@ def render( template, local_assigns )
15 15
 class CustomHandlerTest < Test::Unit::TestCase
16 16
   def setup
17 17
     ActionView::Base.register_template_handler "foo", CustomHandler
  18
+    ActionView::Base.register_template_handler :foo2, CustomHandler
18 19
     @view = ActionView::Base.new
19 20
   end
20 21
 
@@ -25,6 +26,13 @@ def test_custom_render
25 26
       result )
26 27
   end
27 28
 
  29
+  def test_custom_render2
  30
+    result = @view.render_template( "foo2", "hello <%= one %>", nil, :one => "two" )
  31
+    assert_equal(
  32
+      [ "hello <%= one %>", { :one => "two" }, @view ],
  33
+      result )
  34
+  end
  35
+
28 36
   def test_unhandled_extension
29 37
     # uses the ERb handler by default if the extension isn't recognized
30 38
     result = @view.render_template( "bar", "hello <%= one %>", nil, :one => "two" )

0 notes on commit 0c07e08

Please sign in to comment.
Something went wrong with that request. Please try again.