Lesson 3 - Controller routes.rb question


I am stuck with what the routes.rb should be.

I put root 'messages#index'

But then when I go to http://localhost:8000/messages

I ge an error message No route matches [GET] "/messages"

I have tried everything but can't figure it out.

Can anyone help me?

What should my route be?


your root entry takes care of calls to "http://localhost:8000/"

you need another entry for /messages

get '/message' => 'messages#index'


Hey, your answer needs editing, it will be
get '/messages' => 'messages#index'

And thanx for the help :smile:


I need help on the second part


In which FILE you need to paste this get '/messages' => 'messages#index'


Here's the problem guys, what to do ?


Delete the "/messages" part in the first line where you declare the class. Now it should work.

And to see help about the error, click the red alert box, expanding it to see the detailed error.


Still doesn't work, I already tried twice but nothing.


Try generating the controller again. Also paste the text inside the red alert box here.

EDIT: and it is "/messages" =>, not "/message" =>.


Oh, I found out that it's not this : get '/messages' => 'messages#index'

But This, : get '/messages'=>'messages#index'

See the difference ? :wink:



Hello! I'm having trouble finding the routes file. Should I make on my self?



No - you don't make the routes file.

  1. Go to the folder that is named "Config" (it's usually the third folder listed from the top)
  2. Open that folder and click on the file that says config.rb
  3. Type your route in that file
    get '/message' => 'messages#index'

hope that helps


The problem is the / at the begining. The correct line is:

get 'messages' => 'messages#index'




Solved it for me! just needed to add the "s" in /messages


The file location is here.

Enter get 'messages' => 'messages#index' on line #2.


This helped the most out of all other posts

#should see this .rb file
routes.rb #press open

on any open line type in

get '/messages'=>'messages#index'

thank you.


A post was split to a new topic: Lesson 3 - Oops! "The Test Returned an Error"


This topic is inactive.