这是我目前工作的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 –