我使用以下行创建一个链接
link_to_remote 'Delete', :url => mail_path(user_id, mail.id), :confirm => 'Delete?', :method => :delete
这将创建一个 /mail/4.3 形式的 DELETE 请求,路由为
delete 'mail/:user_id/:id', to: 'mail#destroy'
我正在尝试访问我的控制器中的两个 ID
@mail = Mail.find(params[:id])
@user = User.find(params[:user_id])
但是,它失败并出现错误
ActionController::RoutingError (No route matches [DELETE] "/mail/4.3")
我在这里想念什么?
更新 1) “rake routes”的输出
Prefix Verb URI Pattern Controller#Action
mail DELETE /mail/:user_id/:id(.:format) mail#destroy