The second way works. So we'll go with that.
This commit is contained in:
parent
be035f9e31
commit
8f9145ba54
@ -1,17 +0,0 @@
|
|||||||
class RegistrationsController < Devise::RegistrationsController
|
|
||||||
|
|
||||||
before_action :one_user_registered, only: [:new, :create]
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def one_user_registered
|
|
||||||
if User.count == 1
|
|
||||||
if user_signed_in?
|
|
||||||
redirect_to root_path
|
|
||||||
else
|
|
||||||
redirect_to new_user_session_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@ -5,7 +5,11 @@ Rails.application.routes.draw do
|
|||||||
resources :virtuals, only: [ :new, :create, :edit, :update, :destroy]
|
resources :virtuals, only: [ :new, :create, :edit, :update, :destroy]
|
||||||
end
|
end
|
||||||
|
|
||||||
devise_for :users, controllers: { registrations: "registrations" }
|
devise_for :users, :skip => [:registrations]
|
||||||
|
as :user do
|
||||||
|
get 'users/edit' => 'devise/registrations#edit', :as => 'edit_user_registration'
|
||||||
|
put 'users' => 'devise/registrations#update', :as => 'user_registration'
|
||||||
|
end
|
||||||
|
|
||||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user