From: Alex Fenton Date: 2006-01-03T10:37:57+09:00 Subject: Re: output buffering hi mark wrote: > Is there any way to do php-style output buffering with ruby or rails? > as in: > ob_start() In ruby, generally, you'd achieve the same thing by redirecting $stdout. Something like: require 'stringio' tmp_out = StringIO.new() # redirect STDOUT $stdout = tmp_out puts "this and that" # would normally go to STDOUT # restore default stdout $stdout = STDOUT tmp_out.rewind() puts tmp_out.read() # print out what was sent to STDOUT I don't know whether Ruby on Rails has any special facility for temporarily redirecting output of literal HTML snippets within a mixed Ruby-HTML template (as the PHP function does, iirc). The rails mailing list should be able to help you with that one. cheers alex