From 6dbf84f4017f8a35757d4afa3d04230ad444f462 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Wed, 4 May 2022 12:37:31 -0400 Subject: [PATCH] Added nil check to address_to_s --- app/controllers/customers_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index fcb7142..353e266 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -214,14 +214,14 @@ class CustomersController < ApplicationController # format a quickbooks address to a human readable string def address_to_s (address) return if address.nil? - string = address.line1 + string = address.line1 if address.line1 string << "\n" + address.line2 if address.line2 string << "\n" + address.line3 if address.line3 string << "\n" + address.line4 if address.line4 string << "\n" + address.line5 if address.line5 - string << " " + address.city - string << ", " + address.country_sub_division_code - string << " " + address.postal_code + string << " " + address.city if address.city + string << ", " + address.country_sub_division_code if address.country_sub_division_code + string << " " + address.postal_code if address.postal_code return string end