當我運行在軌道傾角路線5應用程序,我看到可用以下網址:支架航線不希望有ID的
edit_articles GET /articles/edit(.:format) articles#edit
articles GET /articles(.:format) articles#show
PATCH /articles(.:format) articles#update
PUT /articles(.:format) articles#update
DELETE /articles(.:format) articles#destroy
當我創建的link_to資源我需要包括ID PARAM在
這個whay它喜歡:
link_to article.name, manager_articles_path(id: article.id)
代替軌道4路:
link_to article.name, manager_articles_path(article)
我怎樣才能使軌道5條航線表現爲軌道4個?
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
謝謝。
的routes.rb
Rails.application.routes.draw do
root 'home#index'
resource :articles
end
嘿請爲您的文章顯示您的'routes.rb'代碼。 –
@ABPrime更新了帖子。 – rmagnum2002