README.md in phony_rails-0.1.10 vs README.md in phony_rails-0.1.11
- old
+ new
@@ -25,12 +25,12 @@
In your model add:
class SomeModel < ActiveRecord::Base
- # Normalizes the attribute itself before
- phony_normalize :phone_number, :default_country_code => 'US'validation
+ # Normalizes the attribute itself before validation
+ phony_normalize :phone_number, :default_country_code => 'US'
# Normalizes attribute before validation and saves into other attribute
phony_normalize :phone_number, :as => :phone_number_normalized_version, :default_country_code => 'US'
# Creates method normalized_fax_number that returns the normalized version of fax_number
@@ -39,10 +39,18 @@
The `:default_country_code` options is used to specify a country_code when normalizing.
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.
+ # :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')
+
### Validation
In your model use the Phony.plausible method to validate an attribute:
validates :phone_number, :phony_plausible => true
@@ -75,9 +83,12 @@
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.1.11
+* Better gemspec dependency versions by rjhaveri.
0.1.10
* Changes from henning-koch.
* Some pending fixes.
\ No newline at end of file