How To: Disable user from destroying their account

Eduardo de Santana Medeiros Alexandre edited this page Dec 28, 2017 · 1 revision

To disable users from destroying their accounts just redefine routes for registrations controller without route to destroy action, so for example:

devise_for :users, skip: :registrations
devise_scope :user do
  resource :registration,
    only: [:new, :create, :edit, :update],
    path: 'users',
    path_names: { new: 'sign_up' },
    controller: 'devise/registrations',
    as: :user_registration do
      get :cancel
    end
end

For more details see devise_registration method from lib/devise/rails/routes.rb.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.