Sha256: f28561a28d3d9bd04b9354007f914ae52265ba461e6f9b7d89764ca1864999ef
Contents?: true
Size: 391 Bytes
Versions: 7
Compression:
Stored size: 391 Bytes
Contents
# coding: utf-8 module RussianPhone class FormatValidator < ActiveModel::Validator def validate(record) options[:fields].each do |field| unless record.send(field).phone.blank? record.errors[field] << 'Неверный телефонный номер' unless record.send(field).valid? && record.send(field).city_allowed? end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems