mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
clean up views & volunteer display
This commit is contained in:
@@ -20,10 +20,8 @@ class BikesController < ApplicationController
|
||||
respond_to do |format|
|
||||
if @bike.save
|
||||
format.html { redirect_to @bike, notice: 'Bike was successfully created.' }
|
||||
format.json { render action: 'show', status: :created, location: @bike }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @bike.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -32,10 +30,8 @@ class BikesController < ApplicationController
|
||||
respond_to do |format|
|
||||
if @bike.update(bike_params)
|
||||
format.html { redirect_to @bike, notice: 'Bike was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: 'edit' }
|
||||
format.json { render json: @bike.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -44,7 +40,6 @@ class BikesController < ApplicationController
|
||||
@bike.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to bikes_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -4,27 +4,38 @@ class VolunteersController < ApplicationController
|
||||
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
|
||||
if @volunteer.save
|
||||
redirect_to @volunteer, notice: 'Volunteer was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def update; end
|
||||
def destroy; end
|
||||
def update
|
||||
if @volunteer.update(volunteer_params)
|
||||
redirect_to @volunteer, notice: 'Volunteer was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@volunteer.destroy
|
||||
redirect_to volunteers_url
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
def set_volunteer
|
||||
|
||||
Reference in New Issue
Block a user