Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 114b5e4b03d27996a2093c789016d6937951eaf6 1 parent bdc80dd
@sikachu sikachu authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 actionpack/lib/action_view/helpers/cache_helper.rb
View
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
yield
- 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 = ActionView::OutputBuffer.new(safe_output_buffer)
+ else
+ fragment = output_buffer.slice!(pos..-1)
+ end
controller.write_fragment(name, fragment, options)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.