Sha256: 6db248fb0477fe98516544c418e37460f369ad301b8b7951f7b7ff80cea09837
Contents?: true
Size: 329 Bytes
Versions: 11
Compression:
Stored size: 329 Bytes
Contents
class IpValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless value =~ /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.ip')) end end end
Version data entries
11 entries across 11 versions & 1 rubygems