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.
This commit is contained in:
Emi Matchu 2023-08-06 16:08:13 -07:00
parent 621a0bc211
commit 75185de957
2 changed files with 6 additions and 1 deletions

View file

@ -7,4 +7,8 @@ class AuthUser < AuthRecord
validates :name, presence: true, uniqueness: {case_sensitive: false}, validates :name, presence: true, uniqueness: {case_sensitive: false},
length: {maximum: 20} length: {maximum: 20}
after_create do
User.create(name: name, auth_server_id: 1, remote_id: id)
end
end end

View file

@ -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 => 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) 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: "") Campaign.create(goal: 100_00, active: true, advertised: false, description: "")