Skip to content

Commit 2b3f222

Browse files
authored
MONGOID-4909 updated documentation to include correct dependency types (#4799)
* MONGOID-4909 updated documentation to include correct dependency types * MONGOID-4909 fixed documentation for new dependency values * MONGOID-4909 update restrict to restrict_with_exception
1 parent bca55c7 commit 2b3f222

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

source/tutorials/mongoid-relations.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -885,10 +885,11 @@ You can provide dependent options to referenced associations to instruct Mongoid
885885
how to handle situations where one side of the association is deleted, or is attempted
886886
to be deleted. The options are as follows:
887887

888-
- ``:delete``: Delete the child document without running any of the model callbacks.
889-
- ``:destroy``: Destroy the child document and run all of the model callbacks.
890-
- ``:nullify``: Orphan the child document.
891-
- ``:restrict``: Raise an error if the child is not empty.
888+
- ``:delete_all``: Delete the child document(s) without running any of the model callbacks.
889+
- ``:destroy``: Destroy the child document(s) and run all of the model callbacks.
890+
- ``:nullify``: Orphan the child document(s).
891+
- ``:restrict_with_exception``: ``raise`` an error if the child is not empty.
892+
- ``:restrict_with_error``: Cancel operation and return false if the child is not empty.
892893

893894
The default behavior of each association when no dependent option is provided is to nullify.
894895

@@ -907,7 +908,7 @@ The default behavior of each association when no dependent option is provided is
907908

908909
class Label
909910
include Mongoid::Document
910-
has_many :bands, dependent: :restrict
911+
has_many :bands, dependent: :restrict_with_exception
911912
end
912913

913914
label = Label.first

0 commit comments

Comments
 (0)