mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
[bug] db:seed throw an error about admin creation
This commit is contained in:
parent
42d2c2ee31
commit
0d82186a78
@ -2,6 +2,7 @@
|
||||
|
||||
## next release
|
||||
|
||||
- Fix a bug: when upgrading from version < 2.5.0, `db:seed` will throw an error if ADMIN_EMAIL does not match any admin in database
|
||||
- Fix a bug: hide spaces in public calendar when module is disabled
|
||||
- Fix a bug: confirmation message not shown after admin creation
|
||||
- add task `rake fablab:get_incoherent_invoice` allow find the invoices incoherent
|
||||
|
@ -82,8 +82,8 @@ if Group.count == 0
|
||||
])
|
||||
end
|
||||
|
||||
# Create the admin if it does not exist yet
|
||||
if User.find_by(email: Rails.application.secrets.admin_email).nil?
|
||||
# Create the default admin if none exists yet
|
||||
if Role.find_by(name: 'admin').users.count === 0
|
||||
admin = User.new(username: 'admin', email: Rails.application.secrets.admin_email, password: Rails.application.secrets.admin_password, password_confirmation: Rails.application.secrets.admin_password, group_id: Group.first.id, profile_attributes: {first_name: 'admin', last_name: 'admin', gender: true, phone: '0123456789', birthday: Time.now})
|
||||
admin.add_role 'admin'
|
||||
admin.save!
|
||||
|
Loading…
x
Reference in New Issue
Block a user