Topic: Issues getting proper web-page response.

Hello everybody, I'm new here, as well as to RoR (but not so much to Ruby).

I am trying to get a "simple" RoR Hello World application running. Here are the steps I have taken and the issues I've received:

sudo apt-get install ruby
sudo apt-get install rails 
sudo apt-get install mysql-server
sudo apt-get install mysql-client
mysql start

This installs ruby/rails/MYSQL with no errors returned.

I then start setting up the project for the hello world application

cd /home/[username]/desktop
rails helloworld
cd ./helloworld
ruby script/server
ruby script/generate controller hi

This creates the project folder "helloworld" on my desktop successfully. It also creates a near-empty file in my controllers folder named "hi". I check to make sure the server is running (which it is, because it returns my 127.0.0.1:3000 with the beautiful default rails index page).

However, when I try and navigate to 127.0.0.1:3000/hi I get the red text of death saying "We're sorry, but something went wrong.", even if I define "index" in the controllers file.

I would appreciate any help getting this fixed. Thank you.

Last edited by champloo11 (2012-09-01 13:02:42)

Re: Issues getting proper web-page response.

Well, you are nearly there

ruby script/generate controller hi

Will just generate a controller for you
p.s.
Try

rails g controller hi

Think of a rails controller as being a folder in a plain html web app
so just generating an empty folder will not actually give you a web page
You need a view (html page) and a route to tell rails how to get to that web page.

I think you would benefit greatly from reading through the rails docs and a good starting point would be
http://guides.rubyonrails.org/getting_started.html
It should answer all the questions you haven't asked yet on how to get your first app running

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)