Skip to content

Commit

Permalink
Merge pull request #1539 from cmeiklejohn/fix_safe_buffer_in_fragment…
Browse files Browse the repository at this point in the history
…_caching

Fragment caching needs to operate on the pure output, not the safebuffer.
  • Loading branch information
tenderlove committed Jun 8, 2011
2 parents 1300c03 + 823aa22 commit 80edbad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion actionpack/lib/action_view/helpers/cache_helper.rb
Expand Up @@ -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
Expand Down

0 comments on commit 80edbad

Please sign in to comment.