how to get eruby to NOT buffer a page
Daniel Mynyk <[email protected]> Wed, 27 Oct 2004 14:14:33 -0500
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
I am using eRuby in IIS on Windows for dynamic web pages. I have a page that will perform large queries on a database which takes a long time. Because of that, I need to display a progress bar at the top of the page while the page is loading. I have written the page in straight ruby and it works, but I would like it to work correctly in eRuby. My page in eRuby buffers the output until it is finished before it is sent to the browser. Because of this, I cannot see the submitted page and the progress bar until the page is done loading. How can I get eRuby to not buffer my page and send output on the fly (as in plain ruby CGI) so that my progress bar feature will work correctly? What I need is the equivalent of Response.Buffer = false (from ASP) for eRuby. In straight Ruby CGI, my web page gets sent to the browser one print at a time. However, I believe eRuby loads and parses the entire document before sending it to the Ruby interpreter. Then the Ruby interpreter will send my browser the entire page buffer. I need to be able to send the page in eRuby piece by piece as it is executing. If I am executing a long database query I need to see the page as it is loading with my animated progress bar graphic before it finishes. If the entire page is buffered before being sent to the browser, the browser may timeout the request. Can someone explain how to not buffer a page in eRuby if it is possible?