Permalink
Browse files

Streamline fragment_for SafeBuffer logic to make it more concise.

  • Loading branch information...
1 parent 81f7bf5 commit d12aa483f23fd32cd3f27be07ff259ee14424d3f @cmeiklejohn cmeiklejohn committed Jun 20, 2011
Showing with 3 additions and 6 deletions.
  1. +3 −6 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,12 +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
- 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)
+ fragment = output_buffer.slice!(pos..-1)
+ if output_buffer.kind_of?(ActiveSupport::SafeBuffer)
+ self.output_buffer = output_buffer.html_safe
end
controller.write_fragment(name, fragment, options)
end

0 comments on commit d12aa48

Please sign in to comment.