From ae88ab5fe65b42f2d87e6a2a45fb25f3be57adf5 Mon Sep 17 00:00:00 2001 From: Gabriel Torres <127896538+Gabe-Torres@users.noreply.github.com> Date: Mon, 1 Jul 2024 23:02:23 -0500 Subject: [PATCH] update: alta/baja adopter_application seed block to have a form_submission to belong to --- db/seeds/01_alta.rb | 7 +++++-- db/seeds/02_baja.rb | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/db/seeds/01_alta.rb b/db/seeds/01_alta.rb index 110a27375..060b9c58b 100644 --- a/db/seeds/01_alta.rb +++ b/db/seeds/01_alta.rb @@ -401,17 +401,20 @@ end_date: upcoming_end_date ) + @form_submission = FormSubmission.create!(organization: @organization, person: Person.create!(name: "John Doe", email: "Doe@gmail.com")) + 10.times do adopter_application = AdopterApplication.new( notes: Faker::Lorem.paragraph, profile_show: true, status: rand(0..4), adopter_foster_account: AdopterFosterAccount.all.sample, - pet: Pet.all.sample + pet: Pet.all.sample, + form_submission: @form_submission ) # Prevent duplicate adopter applications. - redo if AdopterApplication.where(pet_id: adopter_application.pet_id, + redo if AdopterApplication.where(pet_id: adopter_application.pet_id, form_submission_id: adopter_application.form_submission_id, adopter_foster_account_id: adopter_application.adopter_foster_account_id).exists? if adopter_application.valid? diff --git a/db/seeds/02_baja.rb b/db/seeds/02_baja.rb index 47ed1dadd..610965bb2 100644 --- a/db/seeds/02_baja.rb +++ b/db/seeds/02_baja.rb @@ -354,13 +354,16 @@ end_date: upcoming_end_date ) + @form_submission = FormSubmission.create!(organization: @organization, person: Person.create!(name: "John Doe", email: "Doe@gmail.com")) + 10.times do adopter_application = AdopterApplication.new( notes: Faker::Lorem.paragraph, profile_show: true, status: rand(0..4), adopter_foster_account: AdopterFosterAccount.all.sample, - pet: Pet.all.sample + pet: Pet.all.sample, + form_submission: @form_submission ) # Prevent duplicate adopter applications.