Rails + devise:试图删除用户帐号 [英] Rails + devise: Trying to delete user account

查看:116
本文介绍了Rails + devise:试图删除用户帐号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在我的rails应用程序中尝试删除我的帐户时,我得到

When I try and delete my account in my rails app I get

没有路由匹配/ users

No route matches "/users"

我的观点:

<p>We hate to see you go. <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>

我的路线:

user_registration POST   /users(.:format)                         {:action=>"create", :controller=>"devise/registrations"}
new_user_registration GET    /users/sign_up(.:format)                 {:action=>"new", :controller=>"devise/registrations"}
edit_user_registration GET    /users/edit(.:format)                    {:action=>"edit", :controller=>"devise/registrations"}
                   PUT    /users(.:format)                         {:action=>"update", :controller=>"devise/registrations"}
                   DELETE /users(.:format)                         {:action=>"destroy", :controller=>"devise/registrations"}



Am I missing something?

推荐答案

根据您的rake路由输出,您需要使用user_registration_path帮助器,而不是仅仅是registration_path :

According to your rake routes output, you need to use user_registration_path helper instead of just registration_path:

<p>
  We hate to see you go. 
  <%= link_to "Cancel my account", user_registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.
</p>

请仔细检查链接是否被DELETE方法触发(如果包含正确的js文件)

And please double check if the link is triggered with the DELETE method (if the proper js files are included)

这篇关于Rails + devise:试图删除用户帐号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆