Skip to content
Browse files

Merge pull request #1539 from cmeiklejohn/fix_safe_buffer_in_fragment…

…_caching

Fragment caching needs to operate on the pure output, not the safebuffer.
  • Loading branch information...
2 parents 1300c03 + 823aa22 commit 80edbad786735aaa90f49a543d799c4ad22f5877 @tenderlove tenderlove committed Jun 7, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 actionpack/lib/action_view/helpers/cache_helper.rb
View
4 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,7 +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
- fragment = output_buffer.slice!(pos..-1)
+ safe_output_buffer = output_buffer.to_str
+ fragment = safe_output_buffer.slice!(pos..-1)
+ self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)
controller.write_fragment(name, fragment, options)
end
end

0 comments on commit 80edbad

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