README.md in phony_rails-0.13.1 vs README.md in phony_rails-0.14.0
- old
+ new
@@ -77,10 +77,18 @@
PhonyRails.normalize_number('+4790909090', default_country_code: 'SE') # => '+4790909090' (still +47 so not changed)
```
The country_code should always be a ISO 3166-1 alpha-2 (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
+#### Default for all models
+
+You can set the default_country_code for all models using:
+
+```ruby
+PhonyRails.default_country_code = "US"
+```
+
### Validation
In your model use the Phony.plausible method to validate an attribute:
```ruby
@@ -175,9 +183,18 @@
```ruby
"+31 (0)30 1234 123".phony_normalized # => '31301234123'
"(0)30 1234 123".phony_normalized # => '301234123'
"(0)30 1234 123".phony_normalized(country_code: 'NL') # => '301234123'
```
+
+Extensions are supported (identified by "ext", "ex", "x", "xt", "#", or ":") and will show at the end of the number:
+
+```ruby
+"+31 (0)30 1234 123 x999".phony_normalized # => '31301234123 x999'
+"+31 (0)30 1234 123 ext999".phony_normalized # => '31301234123 x999'
+"+31 (0)30 1234 123 #999".phony_normalized # => '31301234123 x999'
+```
+
### Find by normalized number
Say you want to find a record by a phone number. Best is to normalize user input and compare to an attribute stored in the db.