diff options
author | Prem Sichanugrist <s@sikachu.com> | 2011-06-08 01:07:39 -0400 |
---|---|---|
committer | Prem Sichanugrist <s@sikachu.com> | 2011-06-08 02:30:50 -0400 |
commit | 07f2481e152502050f23834596efc76f4a208fc3 (patch) | |
tree | 3b7032ab4f6856a0139d9e0000088b08ad5f0468 /actionpack/lib/action_view/helpers | |
parent | 1d3618a9b47d3160af00992756a4487906e39bcb (diff) | |
download | rails-07f2481e152502050f23834596efc76f4a208fc3.tar.gz rails-07f2481e152502050f23834596efc76f4a208fc3.tar.bz2 rails-07f2481e152502050f23834596efc76f4a208fc3.zip |
Adapt [823aa223efbac6ad4d31ea33402892267bb77cb4] to make sure we perform cloning before manipulation only on `OutputBuffer`.
After the fragment rendering, `Builder` returns the `String` object instead of `ActionView::OutputBuffer`. Somehow the same procedure which was in [823aa223efbac6ad4d31ea33402892267bb77cb4] does not play nice with the String, and result in the fragment got lost.
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/cache_helper.rb | 10 |
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 |