Jump to customer is there is only one result

This commit is contained in:
2016-07-28 23:27:02 -04:00
committed by GitHub
parent a26214fef7
commit 74807c73b0

View File

@@ -20,6 +20,9 @@ class CustomersController < ApplicationController
def index def index
if params[:search] if params[:search]
@customers = Customer.search(params[:search]).paginate(:page => params[:page]) @customers = Customer.search(params[:search]).paginate(:page => params[:page])
if @customers.count = 1
redirect_to @customers.first
end
else else
@customers = Customer.paginate(:page => params[:page]) @customers = Customer.paginate(:page => params[:page])
end end