Module: ActiveModel::Validations::ClassMethods

Defined in:
lib/tough/validators/zxcvbn_password_validator.rb,
lib/tough/validators/minimum_characters_validator.rb,
lib/tough/validators/special_characters_validator.rb,
lib/tough/validators/capitals_and_lowercase_validator.rb

Instance Method Summary collapse

Instance Method Details

#validates_by_zxcvbn_metric(*attr_names) ⇒ Object Also known as: validates_with_zxcvbn

Validates whether or not the specified URL is valid.

class User < ActiveRecord::Base
  validates_url_format_of :site

  # Validates against a list of valid TLD.
  validates_url_format_of :site, tld: true
end


25
26
27
# File 'lib/tough/validators/zxcvbn_password_validator.rb', line 25

def validates_by_zxcvbn_metric(*attr_names)
  validates_with ZxcvbnPasswordValidator, _merge_attributes(attr_names)
end

#validates_capitals_and_lowercase(*attr_names) ⇒ Object Also known as: validates_capitals_and_lowercase_for

Validates whether or not the specified URL is valid.

class User < ActiveRecord::Base
  validates_url_format_of :site

  # Validates against a list of valid TLD.
  validates_url_format_of :site, tld: true
end


20
21
22
# File 'lib/tough/validators/capitals_and_lowercase_validator.rb', line 20

def validates_capitals_and_lowercase(*attr_names)
  validates_with CapitalsAndLowercaseValidator, _merge_attributes(attr_names)
end

#validates_minimum_characters(*attr_names) ⇒ Object Also known as: validates_minimum_characters_for

Validates whether or not the specified URL is valid.

class User < ActiveRecord::Base
  validates_url_format_of :site

  # Validates against a list of valid TLD.
  validates_url_format_of :site, tld: true
end


20
21
22
# File 'lib/tough/validators/minimum_characters_validator.rb', line 20

def validates_minimum_characters(*attr_names)
  validates_with MinimumCharactersValidator, _merge_attributes(attr_names)
end

#validates_special_characters(*attr_names) ⇒ Object Also known as: validates_special_characters_for

Validates whether or not the specified URL is valid.

class User < ActiveRecord::Base
  validates_url_format_of :site

  # Validates against a list of valid TLD.
  validates_url_format_of :site, tld: true
end


20
21
22
# File 'lib/tough/validators/special_characters_validator.rb', line 20

def validates_special_characters(*attr_names)
  validates_with SpecialCharactersValidator, _merge_attributes(attr_names)
end