Try a different method of stopping sign_ups

This commit is contained in:
2024-05-14 20:01:57 +01:00
parent 4c63480a1f
commit be035f9e31
3 changed files with 28 additions and 14 deletions

View File

@@ -1,10 +1,10 @@
class RegistrationsController < Devise::RegistrationsController
before_action :one_user_registered?, only: [:new, :create]
before_action :one_user_registered, only: [:new, :create]
protected
def one_user_registered?
def one_user_registered
if User.count == 1
if user_signed_in?
redirect_to root_path

View File

@@ -16,6 +16,7 @@
<li><%= link_to "Edit account", edit_user_registration_path %></li>
<li><%= button_to "Log out", destroy_user_session_path, method: :delete %></li><% end %>
</menu>
<br/>
</div>