Permalink
Browse files

Only mark the sliced buffer as safe, if it was safe to begin with.

  • Loading branch information...
1 parent d12aa48 commit a52e4189b5e9fe6ef58106302aeb7cfef8804c4a @cmeiklejohn cmeiklejohn committed Jun 20, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 actionpack/lib/action_view/helpers/cache_helper.rb
View
3 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,8 +51,9 @@ def fragment_for(name = {}, options = nil, &block) #:nodoc:
# 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)

0 comments on commit a52e418

Please sign in to comment.