When I run server browser show me something like this:
Routing Error
No route matches [GET] "/static_pages/home"
Try running rake routes for more information on available routes.
Rake routes shows me this:
root / static_pages#home
help /help(.:format) static_pages#help
about /about(.:format) static_pages#about
contact /contact(.:format) static_pages#contact
My routes.rb file:
MyApp::Application.routes.draw do
root :to => 'static_pages#home'
match '/help', :to => 'static_pages#help'
match '/about', :to => 'static_pages#about'
match '/contact', :to =>'static_pages#contact'
end
Anyone got an idea?
There is no route set for the url '/static_pages/home'
Although root points to static_pages controller with action home, it still responds to the path '/' and not '/static_pages/home'
If you add
match '/static_pages/home', :to =>'static_pages#home'
You will get the expected response for '/static_pages/home'
step 5.3.3 Rails tutorial
You don't have to refresh your page
http://localhost:3000/static_pages/home
but only change the URL by
http://localhost:3000/
because you define 'static_pages/home' as root '/'.
For me it works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With