Fixed the Particpant linking issue. Now when creating new Participant correctly links and displays on associated Employer show page.

This commit is contained in:
Ben 2024-02-02 23:33:15 -06:00
parent fedc2e67b7
commit b598b345d5
1 changed files with 3 additions and 0 deletions

View File

@ -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