diff options
author | José Valim <jose.valim@gmail.com> | 2011-06-20 11:01:33 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-06-20 11:01:33 -0700 |
commit | ac78ff76ad0dfcfd897d92b2d50ef0a811e8d4eb (patch) | |
tree | 08cb0428d5dbba16376c3f83e6400a29b59b5372 /actionpack/lib/action_view | |
parent | 81f7bf55c7e15f05015e480505897a82b4038242 (diff) | |
parent | a52e4189b5e9fe6ef58106302aeb7cfef8804c4a (diff) | |
download | rails-ac78ff76ad0dfcfd897d92b2d50ef0a811e8d4eb.tar.gz rails-ac78ff76ad0dfcfd897d92b2d50ef0a811e8d4eb.tar.bz2 rails-ac78ff76ad0dfcfd897d92b2d50ef0a811e8d4eb.zip |
Merge pull request #1787 from cmeiklejohn/make_fragment_for_more_robust_for_subclasses_of_safe_buffer
fragment_for assumes ActionView::OutputBuffer.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/cache_helper.rb | 10 |
1 files changed, 4 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..f81ce3e31c 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -51,12 +51,10 @@ 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) + output_safe = output_buffer.html_safe? + fragment = output_buffer.slice!(pos..-1) + if output_safe + self.output_buffer = output_buffer.html_safe end controller.write_fragment(name, fragment, options) end |