Exception: Mongoid::Errors::UnsavedDocument
- Inherits:
-
MongoidError
- Object
- StandardError
- MongoidError
- Mongoid::Errors::UnsavedDocument
- Defined in:
- build/mongoid-7.3/lib/mongoid/errors/unsaved_document.rb
Overview
Raised when attempting to call create or create! through a references_many when the parent document has not been saved. This prevents the child from getting presisted and immediately being orphaned.
Constant Summary
Constants inherited from MongoidError
Instance Attribute Summary
Attributes inherited from MongoidError
#problem, #resolution, #summary
Instance Method Summary collapse
-
#initialize(base, document) ⇒ UnsavedDocument
constructor
A new instance of UnsavedDocument.
Methods inherited from MongoidError
Constructor Details
#initialize(base, document) ⇒ UnsavedDocument
Returns a new instance of UnsavedDocument.
11 12 13 14 15 16 17 18 |
# File 'build/mongoid-7.3/lib/mongoid/errors/unsaved_document.rb', line 11 def initialize(base, document) super( ( "unsaved_document", { base: base.class.name, document: document.class.name } ) ) end |