Permalink
Browse files

Fixed output_buffer encoding problem [#5179]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 749948a commit 8d5b792e7dadf8b2f64b75b6fee51d15fde70699 @sespindola sespindola committed with josevalim Jul 25, 2010
@@ -165,7 +165,7 @@ def content_for?(name)
def with_output_buffer(buf = nil) #:nodoc:
unless buf
buf = ActionView::OutputBuffer.new
- buf.force_encoding(output_buffer.encoding) if output_buffer && buf.respond_to?(:force_encoding)
+ buf.force_encoding(output_buffer.encoding) if output_buffer.respond_to?(:encoding) && buf.respond_to?(:force_encoding)
end
self.output_buffer, old_buffer = buf, output_buffer
yield
@@ -89,6 +89,15 @@ def test_link_to_function_with_href
link_to_function("Greeting", "alert('Hello world!')", :href => 'http://example.com/')
end
+ def test_link_to_function_with_inner_block
+ html = link_to_function("Greet me!") do |page|
+ content_tag :h1 do
+ 'Hi'
+ end
+ end
+ end
+
+
def test_javascript_tag
self.output_buffer = 'foo'

0 comments on commit 8d5b792

Please sign in to comment.