This Gem adds useful methods to your Rails app to validate, display and save phone numbers. It uses the super awesome Phony gem (https://github.com/floere/phony).
MIT License
556
stars
111
forks
source link
PhonyRails.default_country_code too intrusive in plausible_number? method #179
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.
With Finnish a valid phone number, while having a International code - Works as expected
With default country code DE, the valid Finnish number with international code is deemed implausible by PhonyRails but not Phony.
The name
PhonyRails.default_country_code
suggests that it is a fallback, not an enforcement (eg. like it would be if calledPhonyRails.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.