MongoMapper uses ActiveModel:Validations, so it works almost exactly like ActiveRecord.
Validations are run when attempting to save a record. If validations fail, save will return
Most simple validations can be declared along with the keys.
The available options when defining keys are:
- :required - Boolean that declares
- :unique - Boolean that declares
- :numeric - Boolean that declares
- :format - Regexp that is passed to
- :in - Array that is passed to
- :not_in - Array that is passed to
- :length - Integer, Range, or Hash that is passed to