开发者

Rails Sending the id in the wrong spot

开发者 https://www.devze.com 2023-03-28 23:30 出处:网络
I have a controller called prattachments which has a restful route inside of purchase_requests, but when I try to send a delete request by using this in an each_with_index block:

I have a controller called prattachments which has a restful route inside of purchase_requests, but when I try to send a delete request by using this in an each_with_index block:

link_to "delete", purchase_request_prattachment_path(attachment), :method=>:delete

This route, according to rake routes should be:

purchase_request_prattachment 开发者_运维技巧DELETE /purchase_requests/:purchase_request_id/prattachments/:id {:action=>"destroy", :controller=>"prattachments"}

however, when it is called it reverses :purchase_request and :id, anybody know how to fix it?


call to path should be:

purchase_request_prattachment_path(purchase_request, attachment)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号