When I try and delete my account in my rails app I get
No route matches "/users"
My View:
<p>We hate to see you go. <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
My routes:
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?
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>
And please double check if the link is triggered with the DELETE method (if the proper js files are included)
<p>
Unhappy?
<%= link_to "Cancel my account",
registration_path(current_user),
data: { confirm: "Are you sure?" },
method: :delete %>
</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With