diff options
author | Christopher Meiklejohn <christopher.meiklejohn@gmail.com> | 2011-06-20 12:32:47 -0400 |
---|---|---|
committer | Christopher Meiklejohn <christopher.meiklejohn@gmail.com> | 2011-06-20 13:20:42 -0400 |
commit | d12aa483f23fd32cd3f27be07ff259ee14424d3f (patch) | |
tree | 1d96a842b5f42ef06aa6c30d045eb62617e81085 | |
parent | 81f7bf55c7e15f05015e480505897a82b4038242 (diff) | |
download | rails-d12aa483f23fd32cd3f27be07ff259ee14424d3f.tar.gz rails-d12aa483f23fd32cd3f27be07ff259ee14424d3f.tar.bz2 rails-d12aa483f23fd32cd3f27be07ff259ee14424d3f.zip |
Streamline fragment_for SafeBuffer logic to make it more concise.
-rw-r--r-- | actionpack/lib/action_view/helpers/cache_helper.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index b57617b3d1..ce73f1d4f7 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -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) + 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 |