Skip to content
This repository
Browse code

Streamline fragment_for SafeBuffer logic to make it more concise.

  • Loading branch information...
commit d12aa483f23fd32cd3f27be07ff259ee14424d3f 1 parent 81f7bf5
Christopher Meiklejohn cmeiklejohn authored

Showing 1 changed file with 3 additions and 6 deletions. Show diff stats Hide diff stats

  1. +3 6 actionpack/lib/action_view/helpers/cache_helper.rb
9 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,12 +51,9 @@ def fragment_for(name = {}, options = nil, &block) #:nodoc:
51 51 # This dance is needed because Builder can't use capture
52 52 pos = output_buffer.length
53 53 yield
54   - if output_buffer.is_a?(ActionView::OutputBuffer)
55   - safe_output_buffer = output_buffer.to_str
56   - fragment = safe_output_buffer.slice!(pos..-1)
57   - self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)
58   - else
59   - fragment = output_buffer.slice!(pos..-1)
  54 + fragment = output_buffer.slice!(pos..-1)
  55 + if output_buffer.kind_of?(ActiveSupport::SafeBuffer)
  56 + self.output_buffer = output_buffer.html_safe
60 57 end
61 58 controller.write_fragment(name, fragment, options)
62 59 end

0 comments on commit d12aa48

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