Module: ActiveModel::Validations

Defined in:
lib/can_has_validations/validators/ordering_validator.rb,
lib/can_has_validations/validators/array_validator.rb,
lib/can_has_validations/validators/email_validator.rb,
lib/can_has_validations/validators/ipaddr_validator.rb,
lib/can_has_validations/validators/hostname_validator.rb,
lib/can_has_validations/validators/existence_validator.rb,
lib/can_has_validations/validators/hash_keys_validator.rb,
lib/can_has_validations/validators/write_once_validator.rb,
lib/can_has_validations/validators/grandparent_validator.rb,
lib/can_has_validations/validators/hash_values_validator.rb,
lib/can_has_validations/validators/url_validator.rb

Overview

Ensure an attribute is generally formatted as a URL. If addressable/uri is

already loaded, will use it to parse IDN's.

eg: validates :website, url: true

validates :redis, url: {scheme: 'redis'}
validates :database, url: {scheme: %w(postgres mysql)}
validates :website, url: {host: 'example.com'}
validates :database, url: {port: [5432, nil]}
  to allow scheme's default port, must specify `nil` too

:scheme defaults to ‘%w(http https)` :host defaults to `nil` which allows any :port defaults to `nil` which allows any

to require blank, use `port: false` or `port: [nil]`

Defined Under Namespace

Classes: AfterValidator, ArrayValidator, BeforeValidator, EmailValidator, ExistenceValidator, GrandparentValidator, HashKeysValidator, HashValuesValidator, HostnameValidator, IpaddrValidator, UrlValidator, WriteOnceValidator