You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scenario: A model has 3 phone number fields all with a default_country_code: 'AU'. Setting one of them to explicitly be a foreign number using a + in the number correctly normalises the value as expected. However, after modifying the model and saving it again, the number stored in the database will have the default country code prepended to the phone number that was already perfectly valid. Here's code to illustrate the problem:
Now, I'll create a person with an Australian mobile number and American home number.
When the model is saved, the numbers are correctly normalised. The Australian number is prefixed with 61 and the American number is prefixed with 1. Everything is perfect.
Then, I set the work phone number to another perfectly valid Australian number. When saving, the number is again correctly normalised with a leading 61. However, you'll notice that the home number, the American one, got 61 tacked onto the front of it! This is the problem.
If the assumption is that the numbers stored in the database are already normalised and start with the country code, why is the country code being added again?
Due to a breaking change introduced by the fix of
joost/phony_rails#76 (more specifically
joost/phony_rails@1ad0ed5)
all normalized phone numbers must now have a plus sign before the
country code.
Scenario: A model has 3 phone number fields all with a
default_country_code: 'AU'
. Setting one of them to explicitly be a foreign number using a + in the number correctly normalises the value as expected. However, after modifying the model and saving it again, the number stored in the database will have the default country code prepended to the phone number that was already perfectly valid. Here's code to illustrate the problem:Now, I'll create a person with an Australian mobile number and American home number.
When the model is saved, the numbers are correctly normalised. The Australian number is prefixed with 61 and the American number is prefixed with 1. Everything is perfect.
Then, I set the work phone number to another perfectly valid Australian number. When saving, the number is again correctly normalised with a leading 61. However, you'll notice that the home number, the American one, got 61 tacked onto the front of it! This is the problem.
If the assumption is that the numbers stored in the database are already normalised and start with the country code, why is the country code being added again?
The text was updated successfully, but these errors were encountered: