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.5.27 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.26 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.45 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.25 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.23 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.44 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.22 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.43 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.21 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.42 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.20 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.41 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.19 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.40 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.18 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.39 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.17 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.38 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.5.16 lib/workarea/validators/ip_address_validator.rb
workarea-core-3.4.37 lib/workarea/validators/ip_address_validator.rb