1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Streamline fragment_for SafeBuffer logic to make it more concise.

This commit is contained in:
Christopher Meiklejohn 2011-06-20 12:32:47 -04:00
parent 81f7bf55c7
commit d12aa483f2

View file

@ -51,12 +51,9 @@ module ActionView
# 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)
if output_buffer.kind_of?(ActiveSupport::SafeBuffer)
self.output_buffer = output_buffer.html_safe
end
controller.write_fragment(name, fragment, options)
end