Remove delete/cancel routes

5,384 views
Skip to first unread message

borski

unread,
Apr 17, 2011, 11:54:41 PM4/17/11
to Devise
Hi-

I'm a relative newcomer to Devise, but so far it has been immensely
useful and extensible. Thanks a ton for putting it out there.

I'm trying to remove the ability from the user to cancel/delete his/
her account, since in my particular case I have to keep logs. Is there
any good way to remove a specific route (the delete route) from Rails?
Or do I have to overwrite the destroy/cancel actions in my own
controller? I've tried doing the latter, but for some reason the
cancel overriding isn't working.

The relevant routes follow:

new_user_session GET /users/login(.:format)
{:controller=>"devise/sessions", :action=>"new"}
user_session POST /users/login(.:format)
{:controller=>"devise/sessions", :action=>"create"}
destroy_user_session GET /users/logout(.:format)
{:controller=>"devise/sessions", :action=>"destroy"}
user_password POST /users/password(.:format)
{:controller=>"devise/passwords", :action=>"create"}
new_user_password GET /users/password/new(.:format)
{:controller=>"devise/passwords", :action=>"new"}
edit_user_password GET /users/password/edit(.:format)
{:controller=>"devise/passwords", :action=>"edit"}
PUT /users/password(.:format)
{:controller=>"devise/passwords", :action=>"update"}
cancel_user_registration GET /users/cancel(.:format)
{:controller=>"registrations", :action=>"cancel"}
user_registration POST /users(.:format)
{:controller=>"registrations", :action=>"create"}
new_user_registration GET /users/register(.:format)
{:controller=>"registrations", :action=>"new"}
edit_user_registration GET /users/edit(.:format)
{:controller=>"registrations", :action=>"edit"}
PUT /users(.:format)
{:controller=>"registrations", :action=>"update"}
DELETE /users(.:format)
{:controller=>"registrations", :action=>"destroy"}
user_confirmation POST /users/verification(.:format)
{:controller=>"devise/confirmations", :action=>"create"}
new_user_confirmation GET /users/verification/new(.:format)
{:controller=>"devise/confirmations", :action=>"new"}
GET /users/verification(.:format)
{:controller=>"devise/confirmations", :action=>"show"}
edit_passwords GET /passwords/edit(.:format)
{:controller=>"passwords", :action=>"edit"}
passwords PUT /passwords(.:format)
{:controller=>"passwords", :action=>"update"}
root /(.:format)
{:controller=>"pages", :action=>"home"}

José Valim

unread,
Apr 18, 2011, 2:19:44 AM4/18/11
to Devise
There isn't a straight-forward option. You can either provide a patch
or use :skip => :registerable and add only the routes you want.
Reply all
Reply to author
Forward
0 new messages