Update vehicles_controller.rb

This commit is contained in:
2016-08-01 19:05:49 -04:00
committed by GitHub
parent 632b788082
commit 336d1c7c7b

View File

@@ -18,7 +18,12 @@ class VehiclesController < ApplicationController
# display a list of all vehicles
def index
@vehicles = Vehicle.paginate(:page => params[:page])
if params[:search]
@vehicles = Customer.search(params[:search]).paginate(:page => params[:page])
if only_one_non_zero?(@vehicles)
redirect_to @vehicles.first
end
end
end
# return an HTML form for creating a new vehicle