README.md in phony_rails-0.1.5 vs README.md in phony_rails-0.1.6
- old
+ new
@@ -22,12 +22,19 @@
## Usage
In your model add:
class SomeModel < ActiveRecord::Base
- phony_normalize :phone_number, :default_country_code => 'US' # Normalizes the attribute itself on validation
- phony_normalized_method :fax_number # Creates method normalized_fax_number that returns the normalized version of fax_number
+
+ # Normalizes the attribute itself before
+ phony_normalize :phone_number, :default_country_code => 'US'validation
+
+ # 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
+ phony_normalized_method :fax_number
end
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'`.
@@ -39,9 +46,12 @@
In your views use:
<%= "some number string variable".phony_formatted(:format => :international, :spaces => '-') %>
## Changelog
+
+0.1.6
+* Added :as option to phony_normalize.
0.1.5
* some tests and a helper method by ddidier.
0.1.2