Jump to customer is there is only one result

This commit is contained in:
ricky authored and GitHub committed 2016-07-28 23:27:02 -04:00
1 parent a26214fef7
commit 74807c73b0
1 file changed
+3
+3
View File
@@ -20,6 +20,9 @@ class CustomersController < ApplicationController
def index
if params[:search]
@customers = Customer.search(params[:search]).paginate(:page => params[:page])
if @customers.count = 1
redirect_to @customers.first
end
else
@customers = Customer.paginate(:page => params[:page])
end