0
    SampleApp::Application.routes.draw do
  match '/', :to => 'pages#home'
  match '/contact', :to => 'pages#contact'
  match '/about', :to => 'pages#about'
  match '/help', :to => 'pages#help'
  root :to => 'pages#home'
  get "pages/home"
  get "pages/contact"
  get "pages/about"
  get "pages/help"

end

这是我的 routes.rb 文件。根 :to => 'pages#home' 命令似乎不起作用,在我检查的网站源代码中,它链接到“”而不是 /pages/home。

是的,我删除了公共/索引

耙路线输出:

                     /                        pages#home
      contact     /contact(.:format)       pages#contact
        about     /about(.:format)         pages#about
         help     /help(.:format)          pages#help
         root     /                        pages#home
   pages_home GET /pages/home(.:format)    pages#home
pages_contact GET /pages/contact(.:format) pages#contact
  pages_about GET /pages/about(.:format)   pages#about
   pages_help GET /pages/help(.:format)    pages#help
4

0 回答 0