Module: CouchRest::Validation::ValidatesFormat
- Included in:
- ClassMethods
- Defined in:
- lib/couchrest/validation/validators/format_validator.rb
Overview
class FormatValidator
Instance Method Summary collapse
- #validates_format(*fields) ⇒ Object
-
#validates_format_of(*fields) ⇒ Object
Validates that the attribute is in the specified format.
Instance Method Details
#validates_format(*fields) ⇒ Object
115 116 117 118 |
# File 'lib/couchrest/validation/validators/format_validator.rb', line 115 def validates_format(*fields) warn "[DEPRECATION] `validates_format` is deprecated. Please use `validates_format_of` instead." validates_format_of(*fields) end |
#validates_format_of(*fields) ⇒ Object
Validates that the attribute is in the specified format. You may use the :as (or :with, it’s an alias) option to specify the pre-defined format that you want to validate against. You may also specify your own format via a Proc or Regexp passed to the the :as or :with options.
110 111 112 113 |
# File 'lib/couchrest/validation/validators/format_validator.rb', line 110 def validates_format_of(*fields) opts = opts_from_validator_args(fields) add_validator_to_context(opts, fields, CouchRest::Validation::FormatValidator) end |