49 lines
1.1 KiB
Ruby
49 lines
1.1 KiB
Ruby
|
class ParticipantsController < ApplicationController
|
||
|
before_action :set_participant, only: [:show, :edit, :update, :destroy]
|
||
|
|
||
|
def index
|
||
|
@participants = Participant.all
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
end
|
||
|
|
||
|
def new
|
||
|
@participant = Participant.new
|
||
|
end
|
||
|
|
||
|
def create
|
||
|
@participant = Participant.new(participant_params)
|
||
|
if @participant.save
|
||
|
redirect_to @participant, notice: 'Participant was successfully created.'
|
||
|
else
|
||
|
render :new
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def edit
|
||
|
end
|
||
|
|
||
|
def update
|
||
|
if @participant.update(participant_params)
|
||
|
redirect_to @participant, notice: 'Participant was successfully updated.'
|
||
|
else
|
||
|
render :edit
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def destroy
|
||
|
@participant.destroy
|
||
|
redirect_to participants_url, notice: 'Participant was successfully destroyed.'
|
||
|
end
|
||
|
|
||
|
private
|
||
|
def set_participant
|
||
|
@participant = Participant.find(params[:id])
|
||
|
end
|
||
|
|
||
|
def participant_params
|
||
|
params.require(:participant).permit(:name, :address, :phone, :email, :mci, :dob, :ssn, :gender, :employer_id)
|
||
|
end
|
||
|
end
|
||
|
|