lib/validators/phone_validator.rb in phonelib-0.6.8 vs lib/validators/phone_validator.rb in phonelib-0.6.9
- old
+ new
@@ -41,11 +41,12 @@
include Phonelib::Core
# Validation method
def validate_each(record, attribute, value)
return if options[:allow_blank] && value.blank?
+ country = options[:country_specifier].call(record) if options[:country_specifier]
- phone = parse(value)
+ phone = parse(value, country)
valid = if simple_validation?
method = options[:possible] ? :possible? : :valid?
phone.send(method)
else
(phone_types(phone) & types).size > 0