Skip to content
Browse files

Adapt [059692a] to make sure we perform correct cloning before manipu…

…lation on `OutputBuffer`.

This has been adapted from [823aa22]. However, after the fragment rendering, `Builder` returns the `String` object instead of `ActionView::OutputBuffer`. Somehow the same procedure which was in [823aa22] does not play nice with the String, and result in the fragment got lost.
  • Loading branch information...
1 parent bdc80dd commit 114b5e4b03d27996a2093c789016d6937951eaf6 @sikachu sikachu committed Jun 8, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 actionpack/lib/action_view/helpers/cache_helper.rb
8 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -53,7 +53,13 @@ def fragment_for(name = {}, options = nil, &block) #:nodoc:
# This dance is needed because Builder can't use capture
pos = output_buffer.length
- fragment = output_buffer.to_str.slice!(pos..-1)
+ if output_buffer.is_a?(ActionView::OutputBuffer)
+ safe_output_buffer = output_buffer.to_str
+ fragment = safe_output_buffer.slice!(pos..-1)
+ self.output_buffer =
+ else
+ fragment = output_buffer.slice!(pos..-1)
+ end
controller.write_fragment(name, fragment, options)

0 comments on commit 114b5e4

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