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:

http://wiki.rubyonrails.org/rails/pages … 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:

http://www.floweringdesign.com/hello.rhtml

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

Thanks!

Chris

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
  end
end

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 http://www.floweringdesign.com/hello_world 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.