You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/tutorials/mongoid-relations.txt
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -887,11 +887,13 @@ to be deleted. The options are as follows:
887
887
888
888
- ``:delete_all``: Delete the child document(s) without running any of the model callbacks.
889
889
- ``: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.
891
891
- ``:restrict_with_exception``: ``raise`` an error if the child is not empty.
892
892
- ``:restrict_with_error``: Cancel operation and return false if the child is not empty.
893
893
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.
0 commit comments