Validation¶
Mongoid includes ActiveModel::Validations
to supply the basic
validation plus an additional associated and uniqueness validator.
See the ActiveModel::Validations documentation for more information.
Mongoid behaves slightly different to Active Record when using #valid?
on already persisted data. Active Record’s #valid?
will run all
validations whereas Mongoid’s #valid?
will only run validations on
documents that are in memory as an optimization.