2021-03-19 17:31:38 +02:00
|
|
|
books = Book.create([
|
|
|
|
{
|
|
|
|
title: 'Journey to the Center of the Earth',
|
|
|
|
price: 10900,
|
|
|
|
published: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'From the Earth to the Moon',
|
|
|
|
price: 6300,
|
|
|
|
published: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Imaginary trip',
|
|
|
|
price: 3600,
|
|
|
|
published: true
|
|
|
|
},
|
|
|
|
])
|
|
|
|
|
|
|
|
authors = Author.create([
|
|
|
|
{
|
|
|
|
first_name: 'Jules',
|
|
|
|
last_name: 'Verne'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
first_name: 'Dick',
|
|
|
|
last_name: 'Pick',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
first_name: 'Rick',
|
|
|
|
last_name: 'Pickle'
|
|
|
|
},
|
|
|
|
])
|
|
|
|
|
2021-03-21 20:30:25 +01:00
|
|
|
books.first.authors << authors.first
|
|
|
|
books.second.authors << authors.first
|
|
|
|
books.third.authors << authors.second
|
|
|
|
books.third.authors << authors.third
|
|
|
|
|
|
|
|
User.create([
|
2021-03-19 17:31:38 +02:00
|
|
|
{
|
2021-03-21 20:30:25 +01:00
|
|
|
email: 'abc@o2.pl',
|
|
|
|
password: 'aaaaaaaa',
|
|
|
|
role: :admin
|
2021-03-19 17:31:38 +02:00
|
|
|
},
|
|
|
|
{
|
2021-03-21 20:30:25 +01:00
|
|
|
email: 'abcd@o2.pl',
|
|
|
|
password: 'aaaaaaaa',
|
|
|
|
role: :customer
|
2021-03-19 17:31:38 +02:00
|
|
|
},
|
|
|
|
{
|
2021-03-21 20:30:25 +01:00
|
|
|
email: 'abcde@o2.pl',
|
|
|
|
password: 'aaaaaaaa',
|
|
|
|
role: :customer
|
2021-03-19 17:31:38 +02:00
|
|
|
},
|
|
|
|
])
|