Update customers_controller.rb

This commit is contained in:
2016-04-28 11:58:24 -04:00
parent 76ffda9cad
commit a9ebc4107f

View File

@@ -18,7 +18,7 @@ class CustomersController < ApplicationController
# display a list of all customers # display a list of all customers
def index def index
@customers = QboCustomer.paginate(:page => params[:page]) @customers = Customer.paginate(:page => params[:page])
end end
def new def new
@@ -31,7 +31,7 @@ class CustomersController < ApplicationController
# display a specific customer # display a specific customer
def show def show
@customer = QboCustomer.find_by_id(params[:id]) @customer = Customer.find_by_id(params[:id])
if @customer if @customer
@vehicles = @customer.vehicles.paginate(:page => params[:page]) @vehicles = @customer.vehicles.paginate(:page => params[:page])
else else
@@ -42,12 +42,12 @@ class CustomersController < ApplicationController
# return an HTML form for editing a customer # return an HTML form for editing a customer
def edit def edit
@customer = QboCustomer.find_by_id(params[:id]) @customer = Customer.find_by_id(params[:id])
end end
# update a specific customer # update a specific customer
def update def update
@customer = QboCustomer.find_by_id(params[:id]) @customer = Customer.find_by_id(params[:id])
if @customer.update_attributes(params[:customer]) if @customer.update_attributes(params[:customer])
flash[:success] = "Customer updated" flash[:success] = "Customer updated"
redirect_to @customer redirect_to @customer