When attempting to change my address, but maintain the same State and Country, I received the following error flash:
If editing address, the following fields are required: addressState, addressCountry
After a quick glance at the code, I believe this is because we're using fields_to_update to check whether all address fields are present. However, fields_to_update only contains changed fields.
This means that if a required address field remains unchanged, it will not be included in fields_to_update and will cause an error.
Instead of fields_to_update we could probably use something like:
current_profile.merge(fields_to_update)