diff --git a/app/controllers/participants_controller.rb b/app/controllers/participants_controller.rb new file mode 100644 index 0000000..cde1f19 --- /dev/null +++ b/app/controllers/participants_controller.rb @@ -0,0 +1,49 @@ +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 + \ No newline at end of file diff --git a/app/helpers/participants_helper.rb b/app/helpers/participants_helper.rb new file mode 100644 index 0000000..7059f83 --- /dev/null +++ b/app/helpers/participants_helper.rb @@ -0,0 +1,2 @@ +module ParticipantsHelper +end diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index cd79d94..8f0b644 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,6 +1,3 @@ -// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" import "controllers" -import Rails from '@rails/ujs'; -Rails.start(); diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 5156112..634f723 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,40 +5,22 @@
<%= notice %>
<%= alert %>
- - - + <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> +