Class: RussianPhone::FormatValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- RussianPhone::FormatValidator
- Defined in:
- lib/russian_phone/format_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/russian_phone/format_validator.rb', line 5 def validate(record) [:fields].each do |field| unless record.send(field).phone.blank? unless record.send(field).valid? && record.send(field).city_allowed? record.errors.add(field, 'Неверный телефонный номер') end end end end |