小编Jam*_*mes的帖子

缺失:资源创建的id路由

rake routes创建资源之后:文章说我应该得到:

Prefix Verb      URI Pattern                  Controller#Action
articles  GET    /articles(.:format)          articles#index
          POST   /articles(.:format)          articles#create
new_article  GET /articles/new(.:format)      articles#new
edit_article GET /articles/:id/edit(.:format) articles#edit
article  GET     /articles/:id(.:format)      articles#show
         PATCH   /articles/:id(.:format)      articles#update
         PUT     /articles/:id(.:format)      articles#update
         DELETE  /articles/:id(.:format)      articles#destroy
    root GET     /                            welcome#index
Run Code Online (Sandbox Code Playgroud)

但是我的路线总是缺少那些:id在其中.

Prefix Verb   URI Pattern              Controller#Action
articles POST     /articles(.:format)      articles#create
new_articles  GET /articles/new(.:format)  articles#new
edit_articles GET /articles/edit(.:format) articles#edit
          GET     /articles(.:format)      articles#show
          PATCH   /articles(.:format)      articles#update
          PUT     /articles(.:format)      articles#update
          DELETE  /articles(.:format)      articles#destroy
     root GET     /                        welcome#index
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

3
推荐指数
1
解决办法
296
查看次数

标签 统计

ruby ×1

ruby-on-rails ×1