diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-13 00:25:05 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-13 00:25:05 -0700 |
commit | 3d260760f035c5aab11ab218881ed36e3046157b (patch) | |
tree | 4d75d5d2bcb6693a4768abc2ddc581c27196d227 /actionpack/lib/action_view/helpers/capture_helper.rb | |
parent | 91d274059536f09dffd87141e570c3eab9ebd9b4 (diff) | |
download | rails-3d260760f035c5aab11ab218881ed36e3046157b.tar.gz rails-3d260760f035c5aab11ab218881ed36e3046157b.tar.bz2 rails-3d260760f035c5aab11ab218881ed36e3046157b.zip |
Introduce flush_output_buffer to append the buffer to the response body then start a new buffer. Useful for pushing custom parts to the response body without disrupting template rendering.
Diffstat (limited to 'actionpack/lib/action_view/helpers/capture_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index e86ca27f31..9e39536653 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -131,6 +131,14 @@ module ActionView ensure self.output_buffer = old_buffer end + + # Add the output buffer to the response body and start a new one. + def flush_output_buffer #:nodoc: + if output_buffer && output_buffer != '' + response.body_parts << output_buffer + self.output_buffer = '' + end + end end end end |