Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails app won't delete user account using devise

I am trying to create a prelaunch signup page from the RailsApps Project template: http://railsapps.github.com/rails-prelaunch-signup/

I've deployed it to Heroku and the basic site works fine. You can go to it here: http://arcane-lake-2098.herokuapp.com

The problem is a user can't delete his/her account using the following code in app/views/devise/registrations/edit.html.erb

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

Everything else works fine (create account, edit name, password etc..) - but when I click "Cancel my account" and then click "OK" in the popup window it says "We're sorry, but something went wrong."

I'm using rails 3.2.8

I've hunted through all the Q&A's and most other people seem to have an issue with the route path.

Here are the logs from the error:

2012-10-11T09:46:49+00:00 app[web.1]: Started POST "/users/sign_in" for 49.2.27.159 at 2012-10-11 09:46:49 +0000
2012-10-11T09:46:49+00:00 heroku[router]: POST arcane-lake-2098.herokuapp.com/users/sign_in dyno=web.1 queue=0 wait=0ms service=118ms status=302 bytes=104
2012-10-11T09:46:49+00:00 app[web.1]: 
2012-10-11T09:46:49+00:00 app[web.1]: Started GET "/" for 49.2.27.159 at 2012-10-11 09:46:49 +0000
2012-10-11T09:46:49+00:00 app[web.1]: 
2012-10-11T09:46:49+00:00 heroku[router]: GET arcane-lake-2098.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=11ms status=200 bytes=1521
2012-10-11T09:46:51+00:00 app[web.1]: 
2012-10-11T09:46:51+00:00 app[web.1]: 
2012-10-11T09:46:51+00:00 app[web.1]: Started GET "/users/edit" for 49.2.27.159 at 2012-10-11 09:46:51 +0000
2012-10-11T09:46:51+00:00 heroku[router]: GET arcane-lake-2098.herokuapp.com/users/edit dyno=web.1 queue=0 wait=0ms service=15ms status=200 bytes=2949
2012-10-11T09:46:56+00:00 app[web.1]: 
2012-10-11T09:46:56+00:00 app[web.1]: 
2012-10-11T09:46:56+00:00 app[web.1]: Started DELETE "/users" for 49.2.27.159 at 2012-10-11 09:46:56 +0000
2012-10-11T09:46:57+00:00 app[web.1]: 
2012-10-11T09:46:57+00:00 app[web.1]: 
2012-10-11T09:46:57+00:00 app[web.1]: 
2012-10-11T09:46:57+00:00 app[web.1]: Hominid::APIError (<232> There is no record of "[email protected]" in the database):
2012-10-11T09:46:57+00:00 app[web.1]:   app/models/user.rb:69:in `remove_user_from_mailchimp'
2012-10-11T09:46:57+00:00 heroku[router]: POST arcane-lake-2098.herokuapp.com/users dyno=web.1 queue=0 wait=0ms service=436ms status=500 bytes=643

Feel free to sign up and try cancelling your account to see what I mean.

like image 216
Clark Avatar asked Nov 24 '25 01:11

Clark


1 Answers

This error usually means app throws 500 status code. You need to look at your logs and then search for precise error.

UPDATE 1

As error says in app/models/user.rb line 69 there's attempt to find user with email "[email protected]". As I understand it access remote database with HominidAPI. You probably just missing here existence check, can't say for sure since there's no code for it(and it's probably context specific). I think user is deleted before this method executes and this is causes problem.

like image 101
Vadim Chumel Avatar answered Nov 25 '25 13:11

Vadim Chumel