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
* A `has_many` dependant association accepts `[:destroy, :delete_all, :nullify,
:restrict_with_error, :restrict_with_exception]` as options.
Currently the documentation references `delete` instead of `delete_all`
* Adds documentation for other options
Copy file name to clipboardExpand all lines: guides/source/association_basics.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -932,8 +932,11 @@ If you set the `:dependent` option to:
932
932
933
933
*`:destroy`, when the object is destroyed, `destroy` will be called on its
934
934
associated objects.
935
-
*`:delete`, when the object is destroyed, all its associated objects will be
935
+
*`:delete_all`, when the object is destroyed, all its associated objects will be
936
936
deleted directly from the database without calling their `destroy` method.
937
+
*`:nullify`, causes the foreign key to be set to `NULL`. Callbacks are not executed.
938
+
*`:restrict_with_exception`, causes an exception to be raised if there is an associated record
939
+
*`:restrict_with_error`, causes an error to be added to the owner if there is an associated object
937
940
938
941
WARNING: You should not specify this option on a `belongs_to` association that is connected with a `has_many` association on the other class. Doing so can lead to orphaned records in your database.
0 commit comments