Fixed the Particpant linking issue. Now when creating new Participant correctly links and displays on associated Employer show page.
This commit is contained in:
parent
fedc2e67b7
commit
b598b345d5
|
@ -26,7 +26,10 @@ class ParticipantsController < ApplicationController
|
||||||
if params[:is_employer] == 'yes'
|
if params[:is_employer] == 'yes'
|
||||||
create_employer_and_employer_record_for(@participant)
|
create_employer_and_employer_record_for(@participant)
|
||||||
elsif params[:employer_id].present?
|
elsif params[:employer_id].present?
|
||||||
|
# Assign the selected employer_id to the participant
|
||||||
@participant.employer_id = params[:employer_id]
|
@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
|
end
|
||||||
|
|
||||||
if @participant.save
|
if @participant.save
|
||||||
|
|
Loading…
Reference in New Issue