phony_rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -2
- data/lib/phony_rails/version.rb +1 -1
- data/lib/validators/phony_validator.rb +2 -2
- metadata +5 -5
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# PhonyRails
|
2
|
+
|
3
|
+
(In its early days :) called PhonyNumber)
|
2
4
|
|
3
5
|
This Gem adds useful methods to your Rails app to validate, display and save phone numbers.
|
4
6
|
It uses the super awesome Phony gem (https://github.com/floere/phony).
|
@@ -26,9 +28,13 @@ In your model add:
|
|
26
28
|
phony_normalized_method :fax_number # Creates method normalized_fax_number that returns the normalized version of fax_number
|
27
29
|
end
|
28
30
|
|
31
|
+
The `:default_country_code` options is used to specify a country_code when normalizing.
|
32
|
+
|
33
|
+
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'`.
|
34
|
+
|
29
35
|
Use the Phony.plausible method to validate an attribute:
|
30
36
|
|
31
|
-
validate :phone_number, :
|
37
|
+
validate :phone_number, :phony_plausible => true
|
32
38
|
|
33
39
|
In your views use:
|
34
40
|
|
data/lib/phony_rails/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Uses the Phony.plausible method to validate an attribute.
|
2
2
|
# Usage:
|
3
|
-
# validate :phone_number, :
|
4
|
-
class
|
3
|
+
# validate :phone_number, :phony_plausible => true
|
4
|
+
class PhonyPlausibleValidator < ActiveModel::EachValidator
|
5
5
|
|
6
6
|
# Validates a String using Phony.plausible? method.
|
7
7
|
def validate_each(record, attribute, value)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-07 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: phony
|
16
|
-
requirement: &
|
16
|
+
requirement: &70102155596920 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.6.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70102155596920
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activerecord
|
27
|
-
requirement: &
|
27
|
+
requirement: &70102155596420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '3.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70102155596420
|
36
36
|
description: This Gem adds useful methods to your Rails app to validate, display and
|
37
37
|
save phone numbers.
|
38
38
|
email:
|