Rails Sending the id in the wrong spot
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)
精彩评论