,我有以下毀在我的曲目控制器的方法:路由錯誤 - 無路由匹配[POST]
我可以用毀滅一個發行途徑:
<%= link_to 'Destroy', release_track_path(@release,track), :confirm => 'Are you sure?', :method => :delete %>
但我得到一個路由錯誤「無路由匹配[POST]‘/產品/ 74 /音軌/ 43’,」當我試圖破壞產品導軌:
<%= link_to 'Destroy', product_track_path(@product,track), :confirm => 'Are you sure?', :method => :destroy %>
我已經採取了看看我的路線文件,並認爲這可能是一個問題,但嘗試了幾件事,我很難過!誰能幫忙?這真讓我抓狂。如果使用我的創建方法中的els,則使用相同的方法,並且它對Release Track和Product Track都可以正常工作。
這裏是我的routes.rb(我懷疑這是一個很大的混亂!)
Dashboard::Application.routes.draw do
get "home/index"
root :to => "home#index"
get "tracks/new"
get "tracks/create"
get "tracks/update"
get "tracks/edit"
get "tracks/destroy"
get "tracks/show"
get "tracks/index"
get "help/index"
resources :helps
resources :roles
resources :labels
devise_for :users
resources :users
resources :releases do
resources :artists
resources :tracks
resources :products do
resources :tracks
resources :itunes_data
end
end
resources :itunes_data
resources :tracks do
collection { post :sort }
end
resources :products do
resources :tracks
collection do
get 'schedulecsv'
get 'schedule'
get 'new_releases'
get 'active_lines'
get 'deleted_lines'
get 'gemsetup'
get 'amazonsetup'
get 'search'
end
end
resources :artists
end
它看起來像你在你的Release方法中使用':method =>:delete',但在Track上使用':method =>:destroy'。這是你的調試工件嗎? – ScottJShea 2012-03-16 15:43:03
哈!現在我感到很蠢!猜猜它只是需要另一雙眼睛有時候吧!很多appreicated,謝謝! – Raoot 2012-03-16 15:48:37
沒問題...我一直這麼做......我做的另一件事是調試一段時間嘗試一些事情,然後發佈調試嘗試使事情更令人困惑 – ScottJShea 2012-03-16 15:49:29