mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
Louis | mild refactorings, add name method to bike
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user