how do you create a simple web page with ruby?
I have webhosting that has Ruby/Ruby on Rails.
I know how to set up html web sites. I started learning php, and it's really easy to create a php web page. You just name the file extension .php, and then you intersperse any php code you want in the html with <?php .... ?>. You throw the page up on the web, and it works exactly like you think it would.
But I have *no idea* how to set up a simple "hello world" web page in ruby. Here's a simple web page. I thought you would just name it with .rb or .rhtml and then upload it to your web hosting server and it would work:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>it would be so great if this ruby page worked</title>
<%= puts "Hello World!" %>
But it doesn't work:
1) If I try the file on the hosting server with a .rb extension, it tries to "open" the file like it's downloading a pdf file or something like that.
2) If I try to use an .rhtml extension, it doesn't work. It echoes the plain text code to the screen, but nothing renders.
3) If I try using .html as the extension, the page will load, but the ruby code I'm trying to run gets echoed to the screen as a string literal, so the screen outputs <%= puts "Hello World!" %> instead of Hello World!
So since I already have Ruby and Ruby on Rails in a box ready to go on the webhosting server, what do I do? I thought Ruby was built for the web. But it seems impossible to get a simple web page to render, even on a professional webhosting server that has Ruby/ROR fully installed as part of the package.
Thanks for any ideas here.