2017-11-25 123 views
-1

试图删除回复Rails的无路由匹配[删除]

<% @comment.replies.each do |reply| %> 
<td><%= link_to 'Destroy', comment_replies_path(reply), method: :delete, data: { confirm: 'Are you sure?' }%></td> 

我收到以下错误

No route matches [DELETE] "/comments/66/replies" 

耙路线

comment_reply_path 
      DELETE /comments/:comment_id/replies/:id(.:format) replies#destroy 

,我在URL这一点是

http://localhost:3000/comments/66/replies 

的routes.rb

resources :comments do 
    resources :replies 
end 
+0

,什么是你的routes.rb ? –

+0

@SebastianPalma已更新 – John

回答

0

您的路线说comment_reply_path和你正在使用comment_replies_path

你需要更新你的代码中使用正确的路径帮手

<%= link_to 'Destroy', comment_reply_path(reply), method: :delete, data: { confirm: 'Are you sure?' }%> 
+0

我不知道该怎么做 – John

+0

你有这样的链接 <%= link_to'Destroy',comment_reply_path(回复),方法:: delete,data:{confirm:'你确定吗? }%> – rajbir

相关问题