Include guests in seed

This commit is contained in:
Manuel Bustillo 2024-07-11 20:11:04 +02:00
parent 2ed9f98695
commit f66957dd3d
5 changed files with 14 additions and 2 deletions

View File

@ -48,6 +48,7 @@ group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ]
gem 'rspec-rails', '~> 6.1.0'
gem 'faker'
end
group :development do

View File

@ -91,6 +91,8 @@ GEM
diff-lcs (1.5.0)
drb (2.2.1)
erubi (1.13.0)
faker (3.1.1)
i18n (>= 1.8.11, < 2)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.5)
@ -252,6 +254,7 @@ PLATFORMS
DEPENDENCIES
bootsnap
debug
faker
importmap-rails
jbuilder
money

View File

@ -1,6 +1,6 @@
class CreateGuests < ActiveRecord::Migration[7.1]
def change
create_table :guests do |t|
create_table :guests, id: :uuid do |t|
t.string :first_name
t.string :last_name
t.string :email

2
db/schema.rb generated
View File

@ -26,7 +26,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_11_180753) do
t.datetime "updated_at", null: false
end
create_table "guests", force: :cascade do |t|
create_table "guests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "email"

View File

@ -9,6 +9,7 @@
# end
Expense.delete_all
Guest.delete_all
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
@ -24,3 +25,10 @@ Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed')
Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed')
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed')
300.times do
Guest.create!(first_name: Faker::Name.first_name,
last_name: Faker::Name.last_name,
email: Faker::Internet.email,
phone: Faker::PhoneNumber.cell_phone)
end