phonelib 0.6.14 → 0.6.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phonelib/version.rb +1 -1
- data/lib/validators/phone_validator.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d7e46eb10e0d821b842e5f88e0bb19b155a1d1
|
4
|
+
data.tar.gz: fcb0e4064fbecc3df45a001b6033620c3328fbb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6816d97eaa931ee82e65448cd85fa91d3fb965daf3f3a1c3f62a494d70d424fc16cfa5d0e0ff59e933fd0452f040fa24cbe1ce94d7e6e396ab7afbf9b71cdd6
|
7
|
+
data.tar.gz: '049325fb4deaff9529be193175ea0df3b01b62ca083ed9cf72d6754b3350ddd7413575f5ab4c8c0a84fbfe5c430fb11e955a312513b2bb5408fd5a5823623e34'
|
data/lib/phonelib/version.rb
CHANGED
@@ -51,7 +51,7 @@ class PhoneValidator < ActiveModel::EachValidator
|
|
51
51
|
# Validation method
|
52
52
|
def validate_each(record, attribute, value)
|
53
53
|
return if options[:allow_blank] && value.blank?
|
54
|
-
options[:extensions]
|
54
|
+
allowed_extensions = options.has_key?(:extensions) ? options[:extensions] : true
|
55
55
|
|
56
56
|
phone = parse(value, specified_country(record))
|
57
57
|
valid = if simple_validation?
|
@@ -61,7 +61,7 @@ class PhoneValidator < ActiveModel::EachValidator
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# We default to not-allowing extensions for fax numbers
|
64
|
-
if valid &&
|
64
|
+
if valid && !allowed_extensions && !phone.extension.empty?
|
65
65
|
valid = false
|
66
66
|
end
|
67
67
|
|