I'm using Rails and Devise. There is an Admin
model created by devise.
How can i disable creating admins? (how to disable create
and new
actions is devise controller)
My Rails version is 6.0.1
You can use the skip:
option with devise_for
to skip the generation of routes for any of the Devise controllers:
devise_for :admins, skip: :registrations
If you still want to let the admins update and destroy their accounts you need to manually re-add those routes:
devise_for :admins, skip: :registrations
devise_scope :admin do
resource :admin_registration, only: [:edit, :update, :destroy],
path: 'admins',
controller: 'devise/registrations'
end