Sha256: 68abef494f639ab5b51ff644a6a7f94c37d3a2edfab96bfb82be5abc4389e207

Contents?: true

Size: 313 Bytes

Versions: 1

Compression:

Stored size: 313 Bytes

Contents

# coding: utf-8

module RussianPhone
  class PresenceValidator < ActiveModel::Validator
    def validate(record)
      options[:fields].each do |field|
        if record.send(field).phone.blank?
          record.errors.add(field, 'Необходимо заполнить')
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
russian_phone-0.8.0 lib/russian_phone/presence_validator.rb