From 75185de9579b58419e16de083dfd61ca8ac26e46 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 6 Aug 2023 16:08:13 -0700 Subject: [PATCH] Create a User when we create an AuthUser We also update seeds.rb to be up to date! This should make it possible to log in as test/test123 from a fresh database. --- app/models/auth_user.rb | 4 ++++ db/seeds.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/auth_user.rb b/app/models/auth_user.rb index 18914d8d..47e0d29d 100644 --- a/app/models/auth_user.rb +++ b/app/models/auth_user.rb @@ -7,4 +7,8 @@ class AuthUser < AuthRecord validates :name, presence: true, uniqueness: {case_sensitive: false}, length: {maximum: 20} + + after_create do + User.create(name: name, auth_server_id: 1, remote_id: id) + end end \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb index f30ee996..f06b1ad5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -207,5 +207,6 @@ Zone.create(:id => 50, :label => "Hat", :plain_label => "hat", :depth => 16, :ty Zone.create(:id => 51, :label => "Belt", :plain_label => "belt", :depth => 27, :type_id => 2) Zone.create(:id => 52, :label => "Foreground", :plain_label => "foreground", :depth => 52, :type_id => 3) -User.create(name: "test", auth_server_id: -1, remote_id: -1) +# NOTE: Creating an AuthUser automatically creates a User, too. +AuthUser.create(name: "test", password: "test123", email: "test@gmail.example") Campaign.create(goal: 100_00, active: true, advertised: false, description: "")