Routing Error No route matches [GET] “/static_pages/home”, tutorial

后端 未结 7 1725
挽巷
挽巷 2021-01-06 04:10

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 informa         


        
7条回答
  •  悲哀的现实
    2021-01-06 04:24

    I just got the same error as szatan when I followed the Ruby on Rails tutorial. The error is because, previously, we test URL was http://localhost:3000/static_pages/help since the action is in static_pages. But, after changing routes.rb from

    get 'static_pages/help' to
    match '/help',    to: 'static_pages#help
    

    The URL should changed to http://localhost:3000/help since we tell Rails server to route the path /help to static_pages#help. We shouldn't expect the user to know the path /static_pages/help.

提交回复
热议问题