Monday, December 17, 2007

Hello Rails

Sixty seconds to a web page with Ruby on Rails.
c:\src\>rails Hello

c:\src\>cd Hello

c:\src\Hello>mysql -h localhost -u root -p
Enter password: ****
mysql> create database Hello_development;
Query OK, 1 row affected (0.09 sec)
mysql> quit
Bye

c:\src\Hello>notepad app\controllers\hello_controller.rb

class HelloController < ApplicationController def sayhello render :text => "hello world!" end end
c:\src\Hello>notepad config\database.yaml
password: root
C:\src\Hello>start http://localhost:3000/hello/sayhello
Although the browser opened, the web page doesn't display until the server is started. So start the server then refresh the browser...
C:\src\Hello>ruby script\server