add volunteer table

This commit is contained in:
loos
2014-03-12 19:37:51 -05:00
parent d77bf467eb
commit 65216e3835
14 changed files with 197 additions and 13 deletions
+7 -3
View File
@@ -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
+37
View File
@@ -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