Rails +设计:尝试删除用户帐户

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

没有路由匹配“/ users”

我的看法:

We hate to see you go. "Are you sure?", :method => :delete %>.

我的路线:

 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"} 

我错过了什么吗?

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

 

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

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

 

Unhappy? <%= link_to "Cancel my account", registration_path(current_user), data: { confirm: "Are you sure?" }, method: :delete %>

如果你正在使用设计就行了

 <%= link_to "My Account", edit_user_registration_path %>