Topic: Problem getting rails working on the website

I have Fedora 3 and apache. I have ruby, gem and rails installed.

The issue I have now is getting webpage.rhtml to work. I tried following these instructions: … dWithRails

I did this part:

rails /usr/myapp
ln -s /usr/myapp/public /var/www/myapp

so that it pointed to my server

but when I tried to do a little hello world program it doesn't work:

If anyone can give me a clue what I am doing wrong or how I get going that would be great.



Re: Problem getting rails working on the website

Rails works quite differently to just putting a .rhtml file in your public folder and loading that up. It follows an MVC framework (Model View Controller), where different bits of your app go in different folders and Rails sorts out the addresses for you.

The Agile Web Development with Rails book explains it very well, but there are also plenty of online tutorials that should do as a good starter on how Rails is structured and what you need to do to get started.

To get started with a 'hello world', in your rails app directory (/usr/myapp) do:

./script/generate controller HelloWorld

This will create your controller class file for you in myapp/app/controllers/hello_world_controller.rb

If you edit it so it looks like this:

class HelloWorldController < ApplicationController
  def index

Then create a file called index.rhtml in app/views/hello_world and place your hello world HTML there (just type normal HTML, puts is for the command line).

With that all done, try going to and you should get your hello world text (as long as I haven't forgotten anything, which is possible).

I really would recommend finding a tutorial or two on how Rails works though as you'll need to learn about separating your models, views and controllers.