這是我目前工作的routes.rb文件:資源如何在Rails中工作?
Rails.application.routes.draw do
get 'static_pages/help'
get 'static_pages/test', as: "can_do_this"
get 'static_pages/home', to: "static_pages#home", as: "home"
root 'application#hello'
end
但是,如果我添加一行:
Rails.application.routes.draw do
resources :static_pages #added this line
get 'static_pages/help'
get 'static_pages/test', as: "can_do_this"
get 'static_pages/home', to: "static_pages#home", as: "home"
root 'application#hello'
end
然後我的代碼休息和我的網頁上我有任何的內容不會顯示。有人能向我解釋這條線是什麼以及如何使用它?
請閱讀文檔http://guides.rubyonrails.org/routing.html –