Tstar
Tstar

Reputation: 35

Whats wrong in my first Ruby On Rails application?

I'm new in Ruby On Rails. I installed in 2 days ago on windows and now I want to create a simple "Hello Rails" with it. I use This Tutorial. I did all the steps described in this it does'nt work. the steps are:

  1. write this command in PowerShell: rails generate controller home index
  2. Open app/views/home/index.html.erb in text editor and edit it to contain a single line of code:

    Hello, Rails!

  3. delete the default page from application with this command rm public/index.html

  4. Open the file config/routes.rb in editor, and edit root

:to => "welcome#index"

to

:to => "home#index"

  1. navigate to

"http://localhost:3000"

in my browser but I see this error instead Hello Rails: (I don't have enough reputation to post image of error)

Routing Error

No route matches [GET] "/"

Can anybody tell me whats the problem? Thanks

Upvotes: 2

Views: 179

Answers (1)

Ben Taitelbaum
Ben Taitelbaum

Reputation: 7403

Make sure the only content in your config/routes.rb file is the following:

Blog::Application.routes.draw do
  root :to => "home#index"
end

(just delete everything else for now to make sure it's clean)

Also, try killing the server and making sure that you don't still see that error message (which could indicate that another server is still running somewhere). Along these lines, make sure you see the request in your console output when you fetch the page.

If you're still getting the error, look for any clues in the console error messages.

Upvotes: 2

Related Questions