Friday, January 06, 2006

RoR 101

for a very simple app without a database here is how to start..
  1. name your controller say word
  2. in config/routes.rb map.index '', :controller => "word"
  3. in app/controllers create a new file called word_controller.rb and put a ruby class called WordController.
  4. in app/views createa folder called word.
  5. in app/views/word create a file called index.rhtml
  6. in rename public/index.rhtml to old-index.rhtml
thats enough to get started . and have a lot of fun

now run script/server
even if it complains that it cannot connect to a database just proceed and start it [ this happens if you are using radrails, and i suggest you use radrails ]

now if you point your browser to http://127.0.0.1:3000/ and press enter
you will see that what ever you put in the file app/views/word/index.rhtml is rendered :)

0 Comments:

Post a Comment

<< Home