0

I just upgraded to rails 3.2.8 and devise 2.1.2, totally wiping my User model to use the new migration and setup. I kept my old views though and started to test my user link to destroy/delete their own account. Now I tested this in Firefox and it works with out error, bringing up the confirm box and deleting the account if confirmed. In Google Chrome though I get no confirm box and it goes straight to:

Routing Error
No route matches [GET] "/users"

This is my link as it should be:

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

Anyone else have this madness? Why does it not work for this browser?

LearningRoR
  • 26,582
  • 22
  • 85
  • 150
  • 1
    http://stackoverflow.com/questions/8813791/rails-devise-trying-to-delete-user-account – Abram Aug 31 '12 at 02:10
  • 1
    Just out of curiosity, what happens if you delete all cookies related to your project in Chrome and start again with a fresh sign up? – Abram Aug 31 '12 at 03:39
  • @Abram That didn't work either. Maybe it's a development thing. I'll try it in production soon. – LearningRoR Sep 02 '12 at 15:02
  • Do you have a public github for this.. please link it for me, and I'll troubleshoot it for you – Abram Sep 05 '12 at 10:42

2 Answers2

1

You should see:

edit_user_registration   GET    /users/edit(.:format)            devise/registrations#edit
                         PUT    /users(.:format)                 devise/registrations#update
                         DELETE /users(.:format)                 devise/registrations#destroy

when you run "rake routes" while in the project directory.

Try changing "user_registration_path" to "edit_user_registration_path"

Abram
  • 39,950
  • 26
  • 134
  • 184
  • Did you put: <%= link_to "Delete my account", edit_user_registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %> – Abram Sep 02 '12 at 19:58
  • Yeah that's what it did. Still need to see what happens in production. – LearningRoR Sep 04 '12 at 00:04
  • So I used it in production and it says the address is wrong or in others it doesn't work. – LearningRoR Sep 04 '12 at 15:42
0

Had to change my routes to be correct.

devise_for :users, :controllers => { :registrations => 'registrations' }
  devise_scope :user do
    get 'join' => 'devise/registrations#new', :as => :new_user_registration
    put 'join' => 'devise/registrations#create', :as => :user_registration
    get 'login' => 'devise/sessions#new', :as => :new_user_session
    post 'login' => 'devise/sessions#create', :as => :user_session
    delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session
    get 'account_settings' => 'devise/registrations#edit', :as => :edit_user_registration
    put 'account_settings' => 'devise/registrations#update', :as => :update_user_registration
    get 'forgot_password' => 'devise/passwords#new', :as => :new_user_password
    get 'user', :to => 'user_pages#home', :as => :user_root
  end

  match '/user' => 'user_pages#home', :as => :user_root

and also add to the list:

delete 'join' => 'devise/registrations#destroy', :as => :user_registration

It could have also been that I redid my whole application from scratch.

LearningRoR
  • 26,582
  • 22
  • 85
  • 150