Skip to content

Commit a6e862e

Browse files
authored
MONGOID-4708 update documentation to reflect default dependency option (#4801)
* MONGOID-4708 update documentation to reflect default dependency option * MONGOID-4708 updated dependency documentation
1 parent 2b3f222 commit a6e862e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/tutorials/mongoid-relations.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,11 +887,13 @@ to be deleted. The options are as follows:
887887

888888
- ``:delete_all``: Delete the child document(s) without running any of the model callbacks.
889889
- ``:destroy``: Destroy the child document(s) and run all of the model callbacks.
890-
- ``:nullify``: Orphan the child document(s).
890+
- ``:nullify``: Set the foreign key field of the child document to nil. The child may become orphaned if it is ordinarily only referenced via the parent.
891891
- ``:restrict_with_exception``: ``raise`` an error if the child is not empty.
892892
- ``:restrict_with_error``: Cancel operation and return false if the child is not empty.
893893

894-
The default behavior of each association when no dependent option is provided is to nullify.
894+
If no ``:dependent`` option is provided, deleting the parent record leaves the child record unmodified
895+
(in other words, the child record continues to reference the now deleted parent record via the foreign key field).
896+
The child may become orphaned if it is ordinarily only referenced via the parent.
895897

896898
.. code-block:: ruby
897899

0 commit comments

Comments
 (0)