# Can I send rendered .html to somewhere besides the web serve

**URL:** <https://www.ruby-forum.com/t/can-i-send-rendered-html-to-somewhere-besides-the-web-serve/60924>\
**Category:** Rails\
**Created:** [May 18, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/can-i-send-rendered-html-to-somewhere-besides-the-web-serve/60924 "2006-05-18T16:59:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/d6d6ee/32.png) [@wpwood](https://www.ruby-forum.com/u/wpwood)\
**Post date:** [May 18, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/can-i-send-rendered-html-to-somewhere-besides-the-web-serve/60924/1 "2006-05-18T16:59:16Z")

</div>

Is there any way to tell Rails to send the .html file it renders  
somewhere other than the web server? I need to save a page to the  
server’s file system instead of sending it to the user’s browser.

Thanks!  
Bill

---

<div class="post-metadata">

**Author:** ![wpwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/d6d6ee/32.png) [@wpwood](https://www.ruby-forum.com/u/wpwood)\
**Post date:** [May 18, 2006, 5:13pm UTC](https://www.ruby-forum.com/t/can-i-send-rendered-html-to-somewhere-besides-the-web-serve/60924/2 "2006-05-18T17:13:37Z")

</div>

On 5/18/06, Bill W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there any way to tell Rails to send the .html file it renders somewhere  
> other than the web server? I need to save a page to the server’s file  
> system instead of sending it to the user’s browser.

[http://api.rubyonrails.org/](http://api.rubyonrails.org/)

Look up “render\_to\_string”

---

<div class="post-metadata">

**Author:** ![wpwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/d6d6ee/32.png) [@wpwood](https://www.ruby-forum.com/u/wpwood)\
**Post date:** [May 18, 2006, 5:37pm UTC](https://www.ruby-forum.com/t/can-i-send-rendered-html-to-somewhere-besides-the-web-serve/60924/3 "2006-05-18T17:37:00Z")

</div>

Thanks, James. I’ll check it out!

Best regards,  
Bill  
----- Original Message -----  
From: “James L.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Thursday, May 18, 2006 10:12 AM  
Subject: Re: [Rails] Can I send rendered .html to somewhere besides the  
webserver?

On 5/18/06, Bill W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there any way to tell Rails to send the .html file it renders somewhere  
> other than the web server? I need to save a page to the server’s file  
> system instead of sending it to the user’s browser.

[http://api.rubyonrails.org/](http://api.rubyonrails.org/)

Look up “render\_to\_string”

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

---

<div class="post-metadata">

**Author:** ![wpwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/d6d6ee/32.png) [@wpwood](https://www.ruby-forum.com/u/wpwood)\
**Post date:** [May 18, 2006, 10:36pm UTC](https://www.ruby-forum.com/t/can-i-send-rendered-html-to-somewhere-besides-the-web-serve/60924/4 "2006-05-18T22:36:13Z")

</div>

Hi Martin,

Thanks! I appreciate it very much.

Best regards,  
Bill

----- Original Message -----  
From: “Martin G.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Thursday, May 18, 2006 12:20 PM  
Subject: Re: [Rails] Can I send rendered .html to somewhere besides  
thewebserver?

> > To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> > 
> > removed\_email\_address@domain.invalid  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

---

<div class="post-metadata">

**Author:** ![wpwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/d6d6ee/32.png) [@wpwood](https://www.ruby-forum.com/u/wpwood)\
**Post date:** [May 18, 2006, 7:21pm UTC](https://www.ruby-forum.com/t/can-i-send-rendered-html-to-somewhere-besides-the-web-serve/60924/5 "2006-05-18T19:21:05Z")

</div>

Hi Bill,

This is from a recent post to this list:

@render = render :action =\> controller.action\_name  
outf = File.open(Time.now + “.html”,“w”)  
outf.puts @render  
outf.close

I guess after that you can do whatever you want with outf …

cheers  
Martin
