From b598b345d5da6e5e170db4d9315a2bfac890b4cb Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 2 Feb 2024 23:33:15 -0600 Subject: [PATCH] Fixed the Particpant linking issue. Now when creating new Participant correctly links and displays on associated Employer show page. --- app/controllers/participants_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/participants_controller.rb b/app/controllers/participants_controller.rb index 00542a9..e6d1683 100644 --- a/app/controllers/participants_controller.rb +++ b/app/controllers/participants_controller.rb @@ -26,7 +26,10 @@ class ParticipantsController < ApplicationController if params[:is_employer] == 'yes' create_employer_and_employer_record_for(@participant) elsif params[:employer_id].present? + # Assign the selected employer_id to the participant @participant.employer_id = params[:employer_id] + # Create an EmployerRecord with start_date as current date + EmployerRecord.create!(participant: @participant, employer_id: @participant.employer_id, start_date: Date.today) end if @participant.save