Skip to content
Browse files

Merge pull request #1791 from cmeiklejohn/3-1-stable

Cherry pick of pull #1787 into 3-1-stable
  • Loading branch information...
2 parents f542188 + 03d01ec commit 7ff4aeddbe5ac21912ab97afd3310a835e6cbcf7 @josevalim josevalim committed Jun 20, 2011
Showing with 4 additions and 6 deletions.
  1. +4 −6 actionpack/lib/action_view/helpers/cache_helper.rb
View
10 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,12 +51,10 @@ def fragment_for(name = {}, options = nil, &block) #:nodoc:
# 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)
+ output_safe = output_buffer.html_safe?
+ fragment = output_buffer.slice!(pos..-1)
+ if output_safe
+ self.output_buffer = output_buffer.html_safe
end
controller.write_fragment(name, fragment, options)
end

0 comments on commit 7ff4aed

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