簡體   English   中英

link_to使用rails中的資源路由進行銷毀

[英]link_to destroy using resources route in rails

(沒有路由匹配[DELETE]“/ subscriptions”)

運用

<%= link_to 'Unsubscribe', subscriptions_path(feed_id: session[:read_random].last), method: :delete, remote: :true %>

routes.rb中:

resources :subscriptions

我需要使用DELETE方法實際擁有/ subscriptions / 1 URI的鏈接,但我似乎只能獲得/訂閱?feed_id = 1

嘗試指定要刪除的id或對象:

<%= link_to 'Unsubscribe', subscription_path(session[:read_random].last), method: :delete, remote: :true %>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM