View raw

1 # This file should ensure the existence of records required to run the application in every environment (production, 2 # development, test). The code here should be idempotent so that it can be executed at any point in every environment. 3 # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). 4 # 5 # Example: 6 # 7 # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| 8 # MovieGenre.find_or_create_by!(name: genre_name) 9 # end 10 11 User.create!( 12 email_address: "wtt@marius-peter.com", 13 password: "#wtt2024", 14 password_confirmation: "#wtt2024", 15 admin: true 16 ) 17 puts "Seeded admin account" 18 19 [ { participant: "Pierre et Martin", 20 name: "Paris 11e" 21 }, 22 { participant: "Achille", 23 name: "Tartiff Caraïbe-Ananas" 24 }, 25 { participant: "Michel", 26 name: "L'Irrésistible" 27 }, 28 { participant: "Nicolas", 29 name: "Avaloù-Douariflette" 30 } ].each.with_index(1) do |t, scoring_id| 31 Tartiflette.create!( 32 scoring_id: scoring_id, 33 name: t[:name] 34 ) 35 end 36 puts "Seeded tartiflettes" 37 38 { visuel: [ "présence de la pastille", 39 "croûte dorée", 40 "lardons apparents" ], 41 texture: [ "pommes de terre fondantes", 42 "lardons grillés", 43 "oignons biens cuits" ], 44 goût: [ "reblochon savoureux", 45 "lardons appétants", 46 "vin blanc équilibré" ], 47 special: [ "on en reveut !", 48 "quelqu'un cherche à dépasser les maestros...", 49 "on reconnaît la patte du tartifleur" ] 50 }.each do |category, names| 51 names.each do |name| 52 ScoringCriterium.create!(name: name, category: category) 53 end 54 end 55 puts "Seeded scoring criteria" 56