# Putting Ruby on Web?

**URL:** <https://www.ruby-forum.com/t/putting-ruby-on-web/91853>\
**Category:** Ruby\
**Created:** [April 12, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853 "2007-04-12T20:51:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Merrie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d78d45/32.png) [@Merrie](https://www.ruby-forum.com/u/Merrie)\
**Post date:** [April 12, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853/1 "2007-04-12T20:51:58Z")

</div>

What is the easiest way to get started putting your ruby programs in a  
web browser, such as the cgi program for Mad Libs. Is there a place I  
can get more information on this?

I know a little PHP, not familiar with CGI, I know HTML, XTHML.

Thank you!  
Merrie

---

<div class="post-metadata">

**Author:** ![Merrie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d78d45/32.png) [@Merrie](https://www.ruby-forum.com/u/Merrie)\
**Post date:** [April 12, 2007, 9:06pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853/2 "2007-04-12T21:06:00Z")

</div>

Merrie wrote:

> What is the easiest way to get started putting your ruby programs in a web browser, such as the cgi program for Mad Libs. Is there a place I can get more information on this?

The PickAxe has a chapter about Ruby as CGI. Then there’s eruby, ERb  
(used by Rails), Mongrel…

> I know a little PHP, not familiar with CGI, I know HTML, XTHML.

I can tell you this much: eruby is faster than CGI, especially with  
mod\_ruby for Apache (which is a must), and a lot easier to use, as you  
can embed your Ruby code directly into HTML (no need to emit the correct  
mime-type, for example).

Quick example:

It is now exactly \<%= Time.now %\>

–  
Phillip “CynicalRyan” Gawlowski  
[http://cynicalryan.110mb.com/](http://cynicalryan.110mb.com/)  
[http://clothred.rubyforge.org](http://clothred.rubyforge.org)

Rule of Open-Source Programming #20:

Open Code != Good Code

---

<div class="post-metadata">

**Author:** ![Merrie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d78d45/32.png) [@Merrie](https://www.ruby-forum.com/u/Merrie)\
**Post date:** [April 12, 2007, 9:45pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853/3 "2007-04-12T21:45:05Z")

</div>

And don’t forget Camping! [http://code.whytheluckystiff.net/camping](http://code.whytheluckystiff.net/camping)

Admittedly the docs are spotty, but what there is of them is fun, and  
camping itself seems straightforward.

–Kyle

---

<div class="post-metadata">

**Author:** ![Merrie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d78d45/32.png) [@Merrie](https://www.ruby-forum.com/u/Merrie)\
**Post date:** [April 12, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853/4 "2007-04-12T22:39:11Z")

</div>

Kyle S. wrote:

> And don’t forget Camping! [http://code.whytheluckystiff.net/camping](http://code.whytheluckystiff.net/camping)
> 
> Admittedly the docs are spotty, but what there is of them is fun, and  
> camping itself seems straightforward.

Pick up The 2nd ed. of The Ruby Way. It covers a variety of Ruby Web  
frameworks (though, for various reasons, Camping didn’t make it in).

–  
James B.

“In Ruby, no one cares who your parents were, all they care  
about is if you know what you are talking about.”

- Logan C.

---

<div class="post-metadata">

**Author:** ![Merrie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d78d45/32.png) [@Merrie](https://www.ruby-forum.com/u/Merrie)\
**Post date:** [April 12, 2007, 9:55pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853/5 "2007-04-12T21:55:06Z")

</div>

Kyle S. wrote:

> And don’t forget Camping! [http://code.whytheluckystiff.net/camping](http://code.whytheluckystiff.net/camping)
> 
> Admittedly the docs are spotty, but what there is of them is fun, and  
> camping itself seems straightforward.

The way I understood the OP, the question wasn’t about frameworks (where  
Camping, IOWA and Nitro should be mentioned alongside Rails), but about  
using Ruby as CGI (which would be needed for the frameworks, anyhow).

–  
Phillip “CynicalRyan” Gawlowski  
[http://cynicalryan.110mb.com/](http://cynicalryan.110mb.com/)  
[http://clothred.rubyforge.org](http://clothred.rubyforge.org)

Rule of Open-Source Programming #11:

When a developer says he will work on something, he or she means  
“maybe”.

---

<div class="post-metadata">

**Author:** ![Merrie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d78d45/32.png) [@Merrie](https://www.ruby-forum.com/u/Merrie)\
**Post date:** [April 12, 2007, 10:45pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853/6 "2007-04-12T22:45:12Z")

</div>

Thanks for all the help.

Merrie  
----- Original Message -----  
From: “James B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: “ruby-talk ML” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Thursday, April 12, 2007 4:37 PM  
Subject: Re: Putting Ruby on Web?

---

<div class="post-metadata">

**Author:** ![Merrie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d78d45/32.png) [@Merrie](https://www.ruby-forum.com/u/Merrie)\
**Post date:** [April 13, 2007, 1:22pm UTC](https://www.ruby-forum.com/t/putting-ruby-on-web/91853/7 "2007-04-13T13:22:57Z")

</div>

On 12 Apr 2007, at 19:51, Merrie wrote:

> What is the easiest way to get started putting your ruby programs  
> in a web browser, such as the cgi program for Mad Libs. Is there a  
> place I can get more information on this?
> 
> I know a little PHP, not familiar with CGI, I know HTML, XTHML.

It’s very easy indeed. Either use the CGI module, or look at WEBrick  
which is great fro rolling your own Application Server. That was one  
of the things I demonstrated at RailsConf Europe last year as part of  
my brief intro to not using Rails ;p

I really must stick the presentation online sometime, but if you  
contact me off-list I’ll e-mail you a copy.

I think the same techniques would also be applicable to Mongrel, but  
I’ve not looked at that yet.

Ellie

## Eleanor McHugh Games With Brains

raise ArgumentError unless @reality.responds\_to? :reason
