From a52e4189b5e9fe6ef58106302aeb7cfef8804c4a Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Mon, 20 Jun 2011 13:47:22 -0400 Subject: Only mark the sliced buffer as safe, if it was safe to begin with. --- actionpack/lib/action_view/helpers/cache_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index ce73f1d4f7..f81ce3e31c 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -51,8 +51,9 @@ module ActionView # This dance is needed because Builder can't use capture pos = output_buffer.length yield + output_safe = output_buffer.html_safe? fragment = output_buffer.slice!(pos..-1) - if output_buffer.kind_of?(ActiveSupport::SafeBuffer) + if output_safe self.output_buffer = output_buffer.html_safe end controller.write_fragment(name, fragment, options) -- cgit v1.2.3