Class: Mongoid::Uuid::Validator::UuidValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Mongoid::Uuid::Validator::UuidValidator
- Defined in:
- lib/mongoid/uuid/validator.rb
Instance Method Summary collapse
-
#validate_each(record, attribute, value) ⇒ Object
Ensures that every value is of a valid compact UUID format.
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
Ensures that every value is of a valid compact UUID format.
7 8 9 10 11 |
# File 'lib/mongoid/uuid/validator.rb', line 7 def validate_each(record, attribute, value) unless Mongoid::Uuid.validate(value) record.errors.add(attribute, :invalid_uuid) end end |