From 2507c782e5a00f231dd572e9a9806a4588351dc0 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 25 Nov 2018 20:13:16 +0100 Subject: [PATCH] Add database seeds --- db/seeds.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index ebd1889..decba22 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,9 +1,12 @@ # frozen_string_literal: true -# 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 rails db:seed command (or created alongside the database with db:setup). -# -# Examples: -# -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) +require 'faker' + +user = User.create! username: Faker::Internet.username, email: Faker::Internet.email, password: Faker::Internet.password +tournament = user.tournaments.create! name: Faker::Dog.name +team1 = tournament.teams.create name: Faker::Dog.name +team2 = tournament.teams.create name: Faker::Dog.name +stage = tournament.stages.create! +match = stage.matches.create! +match.scores.create! team: team1, score: 0 +match.scores.create! team: team2, score: 1