README.md in phony_rails-0.5.0 vs README.md in phony_rails-0.6.0
- old
+ new
@@ -24,11 +24,10 @@
### Normalization / Model Usage
For **ActiveRecord**, in your model add:
class SomeModel < ActiveRecord::Base
-
# 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'
@@ -106,20 +105,23 @@
You can also use the bang method (phony_formatted!):
number = "010-12341234"
number.phony_formatted!(:normalize => :NL, :format => :international)
- number # => "+31 10 12341234"
+ number # => "+31 10 123 41234"
### 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.
Home.find_by_normalized_phone_number(PhonyRails.normalize_number(params[:phone_number]))
## Changelog
+0.6.0
+* Support for Phony 2.1 by @pjg.
+
0.5.0
* Added :strict option to String#phony_formatted.
0.4.2
* Added @fareastside validation for country_code.
@@ -175,10 +177,11 @@
0.0.6
* Fixed problem with '070-4157134' being parsed as US number
## TODO
+* Fix phony v2.x issues.
* Make this work: Home.find_by_normalized_phone_number(Home.normalize_number(params[:phone_number]))
So we use Home.normalize_number instead of PhonyRails.normalize_number. This way we can use the same default_country_code.
* Make country_code method configurable.
## Contributing
@@ -187,6 +190,6 @@
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
-Don't forget to add tests and run rspec before creating a pull request :)
\ No newline at end of file
+Don't forget to add tests and run rspec before creating a pull request :)