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

Phone extension support #57

Closed
bourgeois opened this issue Apr 25, 2014 · 6 comments
Closed

Phone extension support #57

bourgeois opened this issue Apr 25, 2014 · 6 comments

Comments

@bourgeois
Copy link

I was wondering if phone extensions are currently supported ?

When I try to enter a phone number, followed by a comma and a phone extension, I get a validation error.

Thanks !

@joost
Copy link
Owner

joost commented May 12, 2014

Currently unsupported. Pull requests welcome :)

@GolfyMcG
Copy link

@joost how did you end up resolving this? I'm curious if you found something that could be turned into a PR or if you did what I'm sorting of thinking of - a separate attribute for extensions to be displayed alongside them.

Edit: Meant to say @bourgeois

@GolfyMcG
Copy link

Also, if anyone has any suggestions as to how this could be implemented, I'd be happy to give it a shot.

@jmera
Copy link
Contributor

jmera commented Sep 16, 2014

After encountering the same problem as @bourgeois, here is my suggestion:

During normalization, don't strip the first 'x' character if it exists. Any numeric characters that follow are considered the extension. If no numeric characters follow, strip the x—there is no extension.

EDIT
You could also let the user specify the "extension delimiting" string or an array of "extension delimiting" strings. It doesn't necessarily have to be 'x'. Something like:
phony_normalize :phone_number, default_country_code: 'US', extension_delimiter: 'ext'
or
phony_normalize :phone_number, default_country_code: 'US', extension_delimiter: %w(ext ext. x)

@joost
Copy link
Owner

joost commented Sep 16, 2014

Pull request welcome for this. I'm not familiar with 'extensions'.. Sounds logical to 'strip' everything after a "," or a "x".

@joost
Copy link
Owner

joost commented Jan 21, 2015

Closing, please reopen when with a pull request.

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

4 participants