class EmploymentsController < ApplicationController
    before_action :set_employment, only: [:edit, :update, :destroy]
  
    def edit
      # Edit view will be rendered
    end
  
    def update
      if @employment.update(employment_params)
        redirect_to participant_path(@employment.participant), notice: 'Employment was successfully updated.'
      else
        render :edit
      end
    end
  
    def destroy
      participant = @employment.participant
      @employment.destroy
      redirect_to participant_path(participant), notice: 'Employment was successfully removed.'
    end
  
    def index
      @employments = Employment.all # or however you need to retrieve the data
    end
    
    private
  
    def set_employment
      @employment = Employment.find(params[:id])
    end
  
    def employment_params
      params.require(:employment).permit(:start_date, :end_date)
    end
  end