mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 08:54:23 -05:00
Update vehicles_controller.rb
This commit is contained in:
@@ -24,9 +24,7 @@ class VehiclesController < ApplicationController
|
||||
# return an HTML form for creating a new vehicle
|
||||
def new
|
||||
@vehicle = Vehicle.new
|
||||
Customer.skip_callback(:find, :after, :get_details)
|
||||
@customers = Customer.all.order(:name)
|
||||
Customer.set_callback(:find, :after, :get_details)
|
||||
end
|
||||
|
||||
# create a new vehicle
|
||||
@@ -39,7 +37,6 @@ class VehiclesController < ApplicationController
|
||||
flash[:error] = @vehicle.errors.full_messages.to_sentence
|
||||
redirect_to new_vehicle_path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# display a specific vehicle
|
||||
@@ -75,11 +72,10 @@ class VehiclesController < ApplicationController
|
||||
|
||||
# delete a specific vehicle
|
||||
def destroy
|
||||
v = Vehicle.find_by_id(params[:id])
|
||||
if v?
|
||||
v.destroy
|
||||
begin
|
||||
Vehicle.find_by_id(params[:id]).destroy
|
||||
flash[:notice] = "Vehicle deleted successfully"
|
||||
else
|
||||
rescue
|
||||
flash[:error] = "No Vehicle Found"
|
||||
end
|
||||
redirect_to action: :index
|
||||
|
||||
Reference in New Issue
Block a user