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。
是的,我删除了public / index
rake路线输出:
/ 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