use state_name in rare cases that state_id is nil, this will prevent …#13
use state_name in rare cases that state_id is nil, this will prevent …#13papayaah wants to merge 1 commit into
Conversation
|
This looks harmless and I'll come back to it. My initial reaction is that we have a data problem if we have a |
|
This is very true but, it's only a data thing (not really a problem). If a country requires states but has no states assigned to it, a text field will show. We really should be disciplined when we go Int to make sure places that we ship to, who are state based, have the correct states added to the country. |
|
although... this is the billing address... so it's really tricky! |
braidn
left a comment
There was a problem hiding this comment.
Looks 💯 David. Do we know what 'state' was written in to cause us to need this fix?
| end | ||
|
|
||
| def state(address) | ||
| address.state ? address.state.name : address.state_name |
There was a problem hiding this comment.
I believe I did this very change in another shipping implementation that utilizes XML! Eerily familiar. Anyway, looks 👍
|
Ah yes, Billing 🇹🇭 |

…the exception
@bryanmtl not exactly sure if this is worth the change - there are only 2 cases of this happening but i can't push the shipment to Quiet because it will cause an exception if state id is nil.