我被困在試圖配置Rails路由的Rails tutorial中。Ruby on Rails routes.rb
這是我的routes.rb:
SampleApp::Application.routes.draw do
match '/', :to => 'static_pages#home', :via => :get
match '/help',:to => 'static_pages#help', :via => :get
match '/about', :to => 'static_pages#about', :via => :get
match '/contact', :to => 'static_pages#contact', :via => :get
當我嘗試訪問 「本地主機」 我得到:
沒有路由匹配[GET] 「/ static_pages /幫助」 嘗試運行耙有關可用路線的更多信息,請致電 。
我也試過:
match '/', :to => 'static_pages#home'
match '/help',:to => 'static_pages#help'
match '/about', :to => 'static_pages#about'
match '/contact', :to => 'static_pages#contact'
但給出了同樣的錯誤。它只適用於我使用時:
get 'static_pages/about'
我怎樣才能讓localhost工作?
我所做的:SampleApp :: Application.routes.draw做 匹配 '/',:到=> 'static_pages#家' 匹配 '/幫助',:要= >'static_pages#help' match'/ about',:to =>'static_pages#about' match'/ contact',:to =>'static_pages#contact' match':action'=>'static#:行動',但它仍然不起作用,同樣的問題 – user1796624
什麼'耙路線'打印?你可能想把它放在www.pastebin.com –
上我的情況':action'=>'static_pages#action'and'static_pages /:action'=>'static_pages#action' – user1796624