Include guests in seed
This commit is contained in:
parent
2ed9f98695
commit
f66957dd3d
1
Gemfile
1
Gemfile
@ -48,6 +48,7 @@ group :development, :test do
|
|||||||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
||||||
gem "debug", platforms: %i[ mri windows ]
|
gem "debug", platforms: %i[ mri windows ]
|
||||||
gem 'rspec-rails', '~> 6.1.0'
|
gem 'rspec-rails', '~> 6.1.0'
|
||||||
|
gem 'faker'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
|
@ -91,6 +91,8 @@ GEM
|
|||||||
diff-lcs (1.5.0)
|
diff-lcs (1.5.0)
|
||||||
drb (2.2.1)
|
drb (2.2.1)
|
||||||
erubi (1.13.0)
|
erubi (1.13.0)
|
||||||
|
faker (3.1.1)
|
||||||
|
i18n (>= 1.8.11, < 2)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
i18n (1.14.5)
|
i18n (1.14.5)
|
||||||
@ -252,6 +254,7 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootsnap
|
bootsnap
|
||||||
debug
|
debug
|
||||||
|
faker
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
money
|
money
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class CreateGuests < ActiveRecord::Migration[7.1]
|
class CreateGuests < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def change
|
||||||
create_table :guests do |t|
|
create_table :guests, id: :uuid do |t|
|
||||||
t.string :first_name
|
t.string :first_name
|
||||||
t.string :last_name
|
t.string :last_name
|
||||||
t.string :email
|
t.string :email
|
||||||
|
2
db/schema.rb
generated
2
db/schema.rb
generated
@ -26,7 +26,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_11_180753) do
|
|||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
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 "first_name"
|
||||||
t.string "last_name"
|
t.string "last_name"
|
||||||
t.string "email"
|
t.string "email"
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
Expense.delete_all
|
Expense.delete_all
|
||||||
|
Guest.delete_all
|
||||||
|
|
||||||
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
||||||
Expense.create!(name: 'Country house', amount: 6000, 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: 'Transportation', amount: 3000, pricing_type: 'fixed')
|
||||||
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
||||||
Expense.create!(name: 'Cake', amount: 500, 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user