Update vehicles_controller.rb

This commit is contained in:
2016-05-11 10:59:44 -04:00
parent 5c9cd88279
commit 7a1d769581

View File

@@ -61,6 +61,7 @@ class VehiclesController < ApplicationController
# update a specific vehicle
def update
@customer = params[:customer]
begin
@vehicle = Vehicle.find_by_id(params[:id])
if @vehicle.update_attributes(params[:vehicle])
flash[:notice] = "Vehicle updated"
@@ -69,6 +70,9 @@ class VehiclesController < ApplicationController
flash[:error] = @vehicle.errors.full_messages.to_sentence if @vehicle.errors
redirect_to edit_vehicle_path
end
rescue ActiveRecord::RecordNotFound
render_404
end
end
# delete a specific vehicle