aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_view/helpers/cache_helper.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb
index b57617b3d1..ce73f1d4f7 100644
--- a/actionpack/lib/action_view/helpers/cache_helper.rb
+++ b/actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,12 +51,9 @@ module ActionView
# This dance is needed because Builder can't use capture
pos = output_buffer.length
yield
- if output_buffer.is_a?(ActionView::OutputBuffer)
- safe_output_buffer = output_buffer.to_str
- fragment = safe_output_buffer.slice!(pos..-1)
- self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)
- else
- fragment = output_buffer.slice!(pos..-1)
+ fragment = output_buffer.slice!(pos..-1)
+ if output_buffer.kind_of?(ActiveSupport::SafeBuffer)
+ self.output_buffer = output_buffer.html_safe
end
controller.write_fragment(name, fragment, options)
end