Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhonyRails.default_country_code too intrusive in plausible_number? method #179

Closed
sergioisidoro opened this issue Aug 28, 2018 · 0 comments

Comments

@sergioisidoro
Copy link

sergioisidoro commented Aug 28, 2018

With Finnish a valid phone number, while having a International code - Works as expected

(byebug) PhonyRails.default_country_code = :fi
:fi
(byebug) PhonyRails.plausible_number?("+358414955444")
true
(byebug) Phony.plausible?("+358414955444")
true

With default country code DE, the valid Finnish number with international code is deemed implausible by PhonyRails but not Phony.

(byebug) PhonyRails.default_country_code = :de
:de
(byebug) PhonyRails.plausible_number?("+358414955444")
false
(byebug) Phony.plausible?("+358414955444")
true

The name PhonyRails.default_country_code suggests that it is a fallback, not an enforcement (eg. like it would be if called PhonyRails.country_code)

Given a valid phone number, even if with a locale different from the default country_code, I would assume it is expected that plausible_number? would return true.

Edit: I just read about enforce_record_country: false, but I would ask you to consider the redesign of the interface of PhonyRails to make it more explicit on what validation it makes. plausible_number? is too broad and gives an erroneous idea of the validation logic it performs.

@joost joost closed this as completed in 99f494d Sep 5, 2018
joost pushed a commit that referenced this issue Sep 5, 2018
Better PhonyRails.plausible_number? method. Closes #179.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant