教程表明如果我运行rake routes
,这应该是预期的
$ rake routes
posts GET /posts(.:format) posts#index
POST /posts(.:format) posts#create
new_post GET /posts/new(.:format) posts#new
edit_post GET /posts/:id/edit(.:format) posts#edit
post GET /posts/:id(.:format) posts#show
PATCH /posts/:id(.:format) posts#update
PUT /posts/:id(.:format) posts#update
DELETE /posts/:id(.:format) posts#destroy
root / welcome#index
但是当我发出命令时,这只显示
welcome_index GET /welcome/index(.:format) welcome#index
root / welcome#index
这背后可能是什么原因?
link - http://edgeguides.rubyonrails.org/getting_started.html
答案 0 :(得分:0)
您需要将以下内容添加到routes.rb
resources :posts