Merge pull request #2088 from kemenaran/initial-user
Crée l'utilisateur initial dans les seeds
This commit is contained in:
commit
0490e58d0b
2 changed files with 15 additions and 16 deletions
17
README.md
17
README.md
|
@ -45,8 +45,8 @@ Les informations nécessaire à l'initialisation de la base doivent être pré-c
|
|||
|
||||
Afin de générer la BDD de l'application, il est nécessaire d'exécuter les commandes suivantes :
|
||||
|
||||
# Create and load the schema for both databases
|
||||
bin/rails db:create db:schema:load
|
||||
# Create and initialize the database
|
||||
bin/rails db:create db:schema:load db:seed
|
||||
|
||||
# Migrate the development database and the test database
|
||||
bin/rails db:migrate
|
||||
|
@ -81,21 +81,12 @@ Dans le fichier `config/intializers/token.rb`, ajouter
|
|||
|
||||
*Note : les valeurs pour ces paramètres sont renseignées dans le Keepass*
|
||||
|
||||
## Création des comptes initiaux
|
||||
|
||||
bin/rails console
|
||||
> email = "<votre email>"
|
||||
> password = "<votre mot de passe>"
|
||||
> Administration.create(email: email, password: password)
|
||||
> Administrateur.create(email: email, password: password)
|
||||
> Gestionnaire.create(email: email, password: password)
|
||||
> User.create(email: email, password: password)
|
||||
|
||||
|
||||
## Lancement de l'application
|
||||
|
||||
overmind s
|
||||
|
||||
Un utilisateur de test est disponible, avec les identifiants `test@exemple.fr`/`testpassword`.
|
||||
|
||||
## Programmation des jobs
|
||||
|
||||
AutoArchiveProcedureJob.set(cron: "* * * * *").perform_later
|
||||
|
|
14
db/seeds.rb
14
db/seeds.rb
|
@ -1,7 +1,15 @@
|
|||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
|
||||
#
|
||||
# Examples:
|
||||
# Create an initial user who can use all roles
|
||||
#
|
||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||
|
||||
default_user = "test@exemple.fr"
|
||||
default_password = "testpassword"
|
||||
|
||||
puts "Create test user '#{default_user}'"
|
||||
Administration.create!(email: default_user, password: default_password)
|
||||
Administrateur.create!(email: default_user, password: default_password)
|
||||
Gestionnaire.create!(email: default_user, password: default_password)
|
||||
User.create!(email: default_user, password: default_password, confirmed_at: DateTime.now)
|
||||
|
|
Loading…
Reference in a new issue