aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Meiklejohn <christopher.meiklejohn@gmail.com>2011-06-20 13:47:22 -0400
committerChristopher Meiklejohn <christopher.meiklejohn@gmail.com>2011-06-20 13:52:21 -0400
commita52e4189b5e9fe6ef58106302aeb7cfef8804c4a (patch)
tree08cb0428d5dbba16376c3f83e6400a29b59b5372
parentd12aa483f23fd32cd3f27be07ff259ee14424d3f (diff)
downloadrails-a52e4189b5e9fe6ef58106302aeb7cfef8804c4a.tar.gz
rails-a52e4189b5e9fe6ef58106302aeb7cfef8804c4a.tar.bz2
rails-a52e4189b5e9fe6ef58106302aeb7cfef8804c4a.zip
Only mark the sliced buffer as safe, if it was safe to begin with.
-rw-r--r--actionpack/lib/action_view/helpers/cache_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb
index ce73f1d4f7..f81ce3e31c 100644
--- a/actionpack/lib/action_view/helpers/cache_helper.rb
+++ b/actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,8 +51,9 @@ module ActionView
# This dance is needed because Builder can't use capture
pos = output_buffer.length
yield
+ output_safe = output_buffer.html_safe?
fragment = output_buffer.slice!(pos..-1)
- if output_buffer.kind_of?(ActiveSupport::SafeBuffer)
+ if output_safe
self.output_buffer = output_buffer.html_safe
end
controller.write_fragment(name, fragment, options)