jamieoo
jamieoo

Reputation: 29

I don't see "hello world" showing up in ruby on rails

I just started Michael Hartl's ruby on rails tutorial book (3rd edition). I've been following all the steps in getting rails set up through cloud9. I installed all the necessary gems and file versions.

I set up my server using this code:

~/workspace/hello_app **$ rails server -b $IP -p $PORT**

Than I changed the settings in the application controller:

class ApplicationController < ActionController::Base
 # Prevent CSRF attacks by raising an exception.
 # For APIs, you may want to use :null_session instead.
 protect_from_forgery with: :exception
 def hello
  render text: "hello, world!"
 end
end

And than I changed the route in routes.rb to:

  # root 'application#hello'

I think I'm following the book exactly but when I go to load the URL it still just shows the default page and none of my changes have gone into effect. I don't see "hello, world!". I have no idea what to do.

Upvotes: 1

Views: 124

Answers (2)

Dharmesh Rupani
Dharmesh Rupani

Reputation: 1007

Update your routes.rbfile

root  'application#hello'

Upvotes: 2

Brian
Brian

Reputation: 5049

You need to uncomment

  # root 'application#hello'

So it reads

root 'application#hello'

Upvotes: 4

Related Questions