README.md in phony_rails-0.2.2 vs README.md in phony_rails-0.3.0
- old
+ new
@@ -42,15 +42,18 @@
PhonyRails will also check your model for a country_code method to use when normalizing the number. So `'070-12341234'` with `country_code` 'NL' will get normalized to `'317012341234'`.
You can also do-it-yourself and call:
# Options:
- # :country_code => The country code we should use.
+ # :country_code => The country code we should use (forced).
# :default_country_code => Some fallback code (eg. 'NL') that can be used as default (comes from phony_normalize_numbers method).
PhonyRails.normalize_number('some number', :country_code => 'NL')
+ PhonyRails.normalize_number('+4790909090', :country_code => 'SE') # => '464790909090' (forced to +46)
+ PhonyRails.normalize_number('+4790909090', :default_country_code => 'SE') # => '4790909090' (still +47 so not changed)
+
### Validation
In your model use the Phony.plausible method to validate an attribute:
validates :phone_number, :phony_plausible => true
@@ -95,9 +98,13 @@
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.
Home.find_by_normalized_phone_number(PhonyRails.normalize_number(params[:phone_number]))
## Changelog
+
+0.3.0
+* Now ability to force change a country_code.
+ See: https://github.com/joost/phony_rails/pull/23#issuecomment-17480463
0.2.1
* Better error handling by @k4nar
0.1.12
\ No newline at end of file