diff options
author | andrea longhi <andrea@spaghetticode.it> | 2020-01-22 10:22:42 +0100 |
---|---|---|
committer | andrea longhi <andrea@spaghetticode.it> | 2020-01-22 10:31:57 +0100 |
commit | c28df097c661387e3e37d06eb56380fb59f58754 (patch) | |
tree | d8a1f8b21e02b3f7c509afda04feb314992a3a13 /lib | |
parent | 48a68fcb692d83e211794ba064fd4448158a0c92 (diff) |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/super_good/solidus_taxjar/calculator_helper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |