I need to include Content-Length in each file. In PHP it would be: <?php ob_start(); ?> html <?php header(''Content-Length: '' . ob_get_length()); ob_end_flush(); ?> How can I do the same in Ruby? Thanks, eduard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060119/4d5e7c00/attachment.html
I think there should be a "how to do equivalent PHP function in Ruby" page on the Wiki... eduard wrote:> I need to include Content-Length in each file. In PHP it would be: > > <?php > ob_start(); > ?> > > html > > <?php > header(''Content-Length: '' . ob_get_length()); ob_end_flush(); > ?> > > How can I do the same in Ruby? > > Thanks, > eduard > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-- I do things for love or money -- +44 (0)7941 219 501 -- aim:oulalipo | yahoo:tachekent
Dorian Mcfarland wrote:> I think there should be a "how to do equivalent PHP function in Ruby" > page on the Wiki...I''ve started http://wiki.rubyonrails.com/rails/pages/PHPEquivalents. The idea is that each page in the PHP manual should have an equivalent in the Rails Wiki, and each PHP function should have a page either showing the way you do it in Ruby/Rails, or a short explanation as to why it''s not necessary. I made a quick start to the main menu and the date/time functions to show what could be done... Good idea? Bad? If people like it, I''ll try to keep up with filling it, but it''d be good to have a few others at it, too. -- Alex
In your Application Controller, add this: after_filter { |controller| controller.response.headers[''Content-Length''] controller.response.body.length } _____ From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of eduard Sent: Thursday, January 19, 2006 9:40 AM To: Rails@lists.rubyonrails.org Subject: [Rails] PHP ob_start in Ruby I need to include Content-Length in each file. In PHP it would be: <?php ob_start(); ?> html <?php header(''Content-Length: '' . ob_get_length()); ob_end_flush(); ?> How can I do the same in Ruby? Thanks, eduard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060119/210514ac/attachment.html
Thanks Tom, it works great! On 1/19/06, Tom Fakes <tom@craz8.com> wrote:> > In your Application Controller, add this: > > > > after_filter { |controller| > > controller.response.headers[''Content-Length''] = controller.response.body.length > > } > > > ------------------------------ > > *From:* rails-bounces@lists.rubyonrails.org [mailto: > rails-bounces@lists.rubyonrails.org] *On Behalf Of *eduard > *Sent:* Thursday, January 19, 2006 9:40 AM > *To:* Rails@lists.rubyonrails.org > *Subject:* [Rails] PHP ob_start in Ruby > > > > I need to include Content-Length in each file. In PHP it would be: > > <?php > ob_start(); > ?> > > html > > <?php > header(''Content-Length: '' . ob_get_length()); ob_end_flush(); > ?> > > How can I do the same in Ruby? > > Thanks, > eduard > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060120/d6230f3c/attachment.html