Louis | mild refactorings, add name method to bike

This commit is contained in:
Loos
2014-09-17 09:37:00 -04:00
parent 277abcb5c0
commit 47980d61b0
6 changed files with 36 additions and 40 deletions
+9 -16
View File
@@ -18,30 +18,24 @@ class BikesController < ApplicationController
def create
@bike = Bike.new(bike_params)
respond_to do |format|
if @bike.save
format.html { redirect_to @bike, notice: 'Bike was successfully created.' }
else
format.html { render action: 'new' }
end
if @bike.save
redirect_to @bike, notice: 'Bike was successfully created.'
else
render action: 'new'
end
end
def update
respond_to do |format|
if @bike.update(bike_params)
format.html { redirect_to @bike, notice: 'Bike was successfully updated.' }
else
format.html { render action: 'edit' }
end
if @bike.update(bike_params)
redirect_to @bike, notice: 'Bike was successfully updated.'
else
render action: 'edit'
end
end
def destroy
@bike.destroy
respond_to do |format|
format.html { redirect_to bikes_url }
end
redirect_to bikes_url
end
private
@@ -56,7 +50,6 @@ class BikesController < ApplicationController
:model,
:bike_type,
:color,
:frame_size,
:log_number,
:purpose,
:serial_number,