From 8b3e70f432d3e2e2118caec22064ae22938fe911 Mon Sep 17 00:00:00 2001 From: Denis Odorcic Date: Wed, 10 Mar 2010 02:12:59 -0500 Subject: [PATCH] Check if output_buffer is a string before calling encoding on it. PrototypeHelper passes in an array to with_output_buffer which causes an exception when content_tags are nested in a block --- .../lib/action_view/helpers/capture_helper.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 8c48300..364952f 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -144,7 +144,7 @@ module ActionView def with_output_buffer(buf = nil) #:nodoc: unless buf buf = ActiveSupport::SafeBuffer.new - buf.force_encoding(output_buffer.encoding) if buf.respond_to?(:force_encoding) + buf.force_encoding(output_buffer.encoding) if buf.respond_to?(:force_encoding) && output_buffer.is_a?(String) end self.output_buffer, old_buffer = buf, output_buffer yield @@ -158,7 +158,7 @@ module ActionView if output_buffer && !output_buffer.empty? response.body_parts << output_buffer new = '' - new.force_encoding(output_buffer.encoding) if new.respond_to?(:force_encoding) + new.force_encoding(output_buffer.encoding) if new.respond_to?(:force_encoding) && output_buffer.is_a?(String) self.output_buffer = new nil end -- 1.6.0.6