Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

'Routing Error No route matches [GET] "/"' when opening treebook application server address in browser

Hi there,

Originally when creating the treebook application I was getting the warning message 'Insecure world writable dir /usr/local in PATH, mode 040777'. I followed the advice in another post and used the command 'sudo chmod o-w /usr/local/'. I no longer get any warnings now, however, when I try to open the application server in the browser I get 'Routing Error No route matches [GET] "/"'.

Can anyone help?

Thanks, Rhys

2 Answers

It seems from your question that you think the two are connected? If they are then, well, good luck. :-) Otherwise, this is simply a routing error I would check in config/routes.rb and check you had a line of code like the following:

 root to: 'statuses#index'

If this is missing then there is not mapping of the URL "/" to any controller action in which case you get the error you see. You can also query rake routes and see if there is a mapping of root directory to any of your contoller actions. You are looking for the prefix column and for a row beginning "root"

rake routes

This can sometimes get a little overwhelming so you can reduce the output by using grep

rake routes | grep root
                    root GET    /                   statuses#index       <== This row

or a controller specifier

rake routes CONTROLLER=statuses
     Prefix Verb   URI Pattern                  Controller#Action
   statuses GET    /statuses(.:format)          statuses#index
            POST   /statuses(.:format)          statuses#create
 new_status GET    /statuses/new(.:format)      statuses#new
edit_status GET    /statuses/:id/edit(.:format) statuses#edit
      status GET    /statuses/:id(.:format)      statuses#show
            PATCH  /statuses/:id(.:format)      statuses#update
            PUT    /statuses/:id(.:format)      statuses#update
            DELETE /statuses/:id(.:format)      statuses#destroy
       feed GET    /feed(.:format)              statuses#index
       root GET    /                            statuses#index      <== This row

If your not having any luck with this try putting in the following into your browser - just to get something happening:

http://localhost:3000/statuses

Rich

Thanks for the quick response Rich. That was the first time I'd had to deal with a problem so it threw me at first. All sorted thanks to your help.

Cheers

Rhys