1
嘗試顯示銷燬鏈接時出現無方法錯誤。軌道上的紅寶石由於路由而沒有方法錯誤
下面的代碼,以我的觀點
<% @followed_locations.each do |followed_location| %>
<tr>
<td><%= followed_location.user_id %></td>
<td><%= followed_location.location_id %></td>
<td><%= link_to 'Show', api_v1_followed_location_path(followed_location) %></td>
<td><%= link_to 'Edit', edit_api_v1_followed_location_path(followed_location) %></td>
<td><%= link_to 'Destroy', followed_location, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
,這裏是我的,因爲我猜它是與命名空間在我的路線,但我的路線
namespace :api do
namespace :v1 do
resources :followed_locations do
collection do
post "by_user_id"
post "by_location_id"
end
end
end
end
代碼不確定如何解決它,我似乎無法找到任何關於此事的在線信息。謝謝你的幫助!
請包括實際的錯誤,例如,堆棧跟蹤。 – 2014-10-02 19:45:19
刪除路徑是顯示路徑和':delete'方法的組合。在你的情況:'api_v1_followed_location_path(followed_location),方法:: delete' – MrYoshiji 2014-10-02 19:45:40
(但是,它是嵌套的,所以你必須使用完整的資源路徑。) – 2014-10-02 19:48:03