Module: MirroringHouse::Validations::ValidatesFormatOfURI::ClassMethods

Defined in:
lib/mirroring_house/validations/validates_format_of_uri.rb

Instance Method Summary collapse

Instance Method Details

#validates_format_of_uri(*attr_names) ⇒ Object

Validates that the specified attribute parses correctly as a URI, and matches the restrictions specified.

class Person < ActiveRecord::Base validates_format_of_uri :website end

Configuration options:

  • :schemes - An Array of Symbols describing allowed URI schemes (e.g. [ :http, :https ], to allow https:// and http:// URIs)


60
61
62
# File 'lib/mirroring_house/validations/validates_format_of_uri.rb', line 60

def validates_format_of_uri(*attr_names)
  validates_with InstanceMethods::URIFormatValidator, _merge_attributes(attr_names)
end