Sha256: 16dd812ed5695dd4ee621c3680a9077a9cb76a9d2f93d12448497754e9e92a45

Contents?: true

Size: 233 Bytes

Versions: 62

Compression:

Stored size: 233 Bytes

Contents

class IpAddressValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless value.blank? or IPAddress.valid?(value)
      record.errors[attribute] << 'must be a valid IP address.'
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.12 lib/workarea/validators/ip_address_validator.rb