My blog has a devise model called Admin
.
I definitely don't want that visitors of my website can register as an admin. So I did the following:
In my config/routes.rb
devise_for :admins, controllers: { registrations: "registrations" }
After that I created a new app/controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
before_action :authenticate_admin!
end
But when I visit my my.site/admins/sign_up
as a "normal visitor" the authenticate_admin!
hook is not called - so I get a full working registration form. Why isn't this working as expected?