aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/cache_helper.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-06-07 23:39:49 -0700
committerJosé Valim <jose.valim@gmail.com>2011-06-07 23:39:49 -0700
commitc6503f48bd13c696fcc81f2a4a87b8cd7c009657 (patch)
treec4c1ddcce93b19d22b5ec69d01cc5f4aa1a19ed5 /actionpack/lib/action_view/helpers/cache_helper.rb
parent185235333c7b345e7cbb6384446c89d8447f5d79 (diff)
parent1bbc51e5a73a5f97565abae43f13f96209441bb8 (diff)
downloadrails-c6503f48bd13c696fcc81f2a4a87b8cd7c009657.tar.gz
rails-c6503f48bd13c696fcc81f2a4a87b8cd7c009657.tar.bz2
rails-c6503f48bd13c696fcc81f2a4a87b8cd7c009657.zip
Merge pull request #1547 from sikachu/safebuffer
Fix ActionPack tests on `master`
Diffstat (limited to 'actionpack/lib/action_view/helpers/cache_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/cache_helper.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb
index d070f14af1..b57617b3d1 100644
--- a/actionpack/lib/action_view/helpers/cache_helper.rb
+++ b/actionpack/lib/action_view/helpers/cache_helper.rb
@@ -51,9 +51,13 @@ module ActionView
# This dance is needed because Builder can't use capture
pos = output_buffer.length
yield
- safe_output_buffer = output_buffer.to_str
- fragment = safe_output_buffer.slice!(pos..-1)
- self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)
+ 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)
+ end
controller.write_fragment(name, fragment, options)
end
end