mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
add volunteer table
This commit is contained in:
@@ -49,13 +49,17 @@ class BikesController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_bike
|
||||
@bike = Bike.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def bike_params
|
||||
params.require(:bike).permit(:entry_date, :brand, :model, :type, :color, :frame_size, :freecyclery, :sale, :serial_number, :notes, :tag_info, :repaired_by, :completion_date, :price, :created_at, :updated_at)
|
||||
params.require(:bike).permit(:entry_date, :brand, :model,
|
||||
:type, :color, :frame_size,
|
||||
:log_number, :purpose, :serial_number,
|
||||
:notes, :tag_info, :mechanic,
|
||||
:completion_date, :price,
|
||||
:top_tube_size, :seat_tube_size,
|
||||
:created_at, :updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
class VolunteersController < ApplicationController
|
||||
before_action :set_volunteer, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@volunteers = Volunteer.all
|
||||
end
|
||||
def show; end
|
||||
def new
|
||||
@volunteer = Volunteer.new
|
||||
end
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
@volunteer = Volunteer.new(volunteer_params)
|
||||
respond_to do |format|
|
||||
if @volunteer.save
|
||||
format.html { redirect_to @volunteer, notice: 'Volunteer was successfully created.' }
|
||||
format.json { render action: 'show', status: :created, location: @bike }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @volunteer.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update; end
|
||||
def destroy; end
|
||||
|
||||
private
|
||||
def set_volunteer
|
||||
@volunteer = Volunteer.find(params[:id])
|
||||
end
|
||||
|
||||
def volunteer_params
|
||||
params.require(:volunteer).permit(:name, :email, :phone)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user