From c28df097c661387e3e37d06eb56380fb59f58754 Mon Sep 17 00:00:00 2001 From: andrea longhi Date: Wed, 22 Jan 2020 10:22:42 +0100 Subject: Avoid raising unnecessary errors with incomplete address When validating addresses, it may happen that the address has no country, so trying to fetch the country ISO raises an unnecessary error. Using ruby safe navigation prevents this to happen. Of course, the address will still result invalid eventually. --- lib/super_good/solidus_taxjar/calculator_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/super_good/solidus_taxjar') diff --git a/lib/super_good/solidus_taxjar/calculator_helper.rb b/lib/super_good/solidus_taxjar/calculator_helper.rb index 89dedc0..636f322 100644 --- a/lib/super_good/solidus_taxjar/calculator_helper.rb +++ b/lib/super_good/solidus_taxjar/calculator_helper.rb @@ -17,7 +17,7 @@ module SuperGood address.city, address&.state&.abbr || address.state_name, address.zipcode, - address.country.iso + address.country&.iso ].any?(&:blank?) end -- cgit v1.2.3