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