我收到以下錯誤:的ActionController :: UrlGenerationError在文章#編輯
沒有路由匹配{:動作=> 「秀」,:控制器=> 「文章」,:ID =>零}缺少必需的鍵:[:id]
以下是顯示錯誤的代碼。
<%= form_for :article, url: article_path(@article), method: :patch do |f| %>
什麼是這個錯誤,每當我點擊從前一屏幕編輯,我想我發送文章ID。
這裏是我的耙路輸出
Prefix Verb URI Pattern Controller#Action
welcome_index GET /welcome/index(.:format) welcome#index
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
你可以發佈你的'rake routes'輸出嗎? – Pavan
我已經在問題本身中包含了rake路由輸出 – user3726986
當您將該行更改爲'<%= form_for @article,url:article_path(@article),method :: patch do | f |時,會發生什麼? %>'? – Pavan