Skip to content

Domain validator #94

@skalee

Description

@skalee

A separate validator for fields storing domains may be useful. Consider following example:

class Site
  include ActiveModel::Validations

  attr_accessor :registered_domain
  validates :registered_domain, domain: { resolvable: true }
end

object = Site.new

object.registered_domain = "google.com"
object.valid? # => true

object.registered_domain = "asdfasdfasd.asdfasdfasdf.com"
object.valid? # => false

This is just an early concept. I'm not yet sure what validation options will be useful. I guess checking that domain is resolvable, and that host is reachable. Also some checks like if it fits given regexp, or is subdomain of given domain, things like that..

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions