Fixed filter_vehicles_by_customer method

This commit is contained in:
2017-03-22 21:55:07 -04:00
committed by GitHub
parent 48b6df0cef
commit 8af97072fb

View File

@@ -34,10 +34,8 @@ class CustomersController < ApplicationController
autocomplete :customer, :name, :full => false, :extra_data => [:id]
def autocomplete_customer_vehicles
customer = Customer.find_by_id(params[:term])
items = customer.vehicles if customer
render :json => items.to_json if items
def filter_vehicles_by_customer
@filtered_vehicles = Vehicle.all.where(customer_id: params[:selected_customer])
end
# display a list of all customers
@@ -144,10 +142,6 @@ class CustomersController < ApplicationController
end
end
def filter_vehicles_by_customer
@filtered_vehicles = Customer.find(customer_id: params[:selected_customer]).vehicles
end
private
def only_one_non_zero?( array )