mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update vehicles_controller.rb
This commit is contained in:
@@ -61,13 +61,17 @@ class VehiclesController < ApplicationController
|
|||||||
# update a specific vehicle
|
# update a specific vehicle
|
||||||
def update
|
def update
|
||||||
@customer = params[:customer]
|
@customer = params[:customer]
|
||||||
@vehicle = Vehicle.find_by_id(params[:id])
|
begin
|
||||||
if @vehicle.update_attributes(params[:vehicle])
|
@vehicle = Vehicle.find_by_id(params[:id])
|
||||||
flash[:notice] = "Vehicle updated"
|
if @vehicle.update_attributes(params[:vehicle])
|
||||||
redirect_to @vehicle
|
flash[:notice] = "Vehicle updated"
|
||||||
else
|
redirect_to @vehicle
|
||||||
flash[:error] = @vehicle.errors.full_messages.to_sentence if @vehicle.errors
|
else
|
||||||
redirect_to edit_vehicle_path
|
flash[:error] = @vehicle.errors.full_messages.to_sentence if @vehicle.errors
|
||||||
|
redirect_to edit_vehicle_path
|
||||||
|
end
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user