Sha256: 8b39cd9ae055f3de5b905285e2da65b04a8ab111ae13bc1eae0378afb790a0fe

Contents?: true

Size: 311 Bytes

Versions: 7

Compression:

Stored size: 311 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[field] << 'Необходимо заполнить'
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
russian_phone-0.7.0 lib/russian_phone/presence_validator.rb
russian_phone-0.6.1 lib/russian_phone/presence_validator.rb
russian_phone-0.6.0 lib/russian_phone/presence_validator.rb
russian_phone-0.5.3 lib/russian_phone/presence_validator.rb
russian_phone-0.5.2 lib/russian_phone/presence_validator.rb
russian_phone-0.5.1 lib/russian_phone/presence_validator.rb
russian_phone-0.5.0 lib/russian_phone/presence_validator.rb