Merge pull request #7 from turniere/feature/db-seeds
Add database seeds
This commit is contained in:
commit
9f186ef128
17
db/seeds.rb
17
db/seeds.rb
|
|
@ -1,9 +1,12 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# This file should contain all the record creation needed to seed the database with its default values.
|
require 'faker'
|
||||||
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
|
||||||
#
|
user = User.create! username: Faker::Internet.username, email: Faker::Internet.email, password: Faker::Internet.password
|
||||||
# Examples:
|
tournament = user.tournaments.create! name: Faker::Dog.name
|
||||||
#
|
team1 = tournament.teams.create name: Faker::Dog.name
|
||||||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
team2 = tournament.teams.create name: Faker::Dog.name
|
||||||
# Character.create(name: 'Luke', movie: movies.first)
|
stage = tournament.stages.create!
|
||||||
|
match = stage.matches.create!
|
||||||
|
match.scores.create! team: team1, score: 0
|
||||||
|
match.scores.create! team: team2, score: 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue