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
This reverts commits 5147ab1 and 391043a.
These commits looked to intend to change documents of has_many dependent options, but actually changed documents of belongs_to dependent options.
Copy file name to clipboardExpand all lines: guides/source/association_basics.md
+5-6Lines changed: 5 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -966,13 +966,12 @@ side of the association.
966
966
Counter cache columns are added to the containing model's list of read-only attributes through `attr_readonly`.
967
967
968
968
##### `:dependent`
969
-
Controls what happens to associated objects when their owner is destroyed:
969
+
If you set the `:dependent` option to:
970
970
971
-
*`:destroy` causes the associated objects to also be destroyed.
972
-
*`:delete_all` causes the associated objects to be deleted directly from the database (callbacks are not executed).
973
-
*`:nullify` causes the foreign keys to be set to `NULL` (callbacks are not executed).
974
-
*`:restrict_with_exception` causes an exception to be raised if there are associated records.
975
-
*`:restrict_with_error` causes an error to be added to the owner if there are associated objects.
971
+
*`:destroy`, when the object is destroyed, `destroy` will be called on its
972
+
associated objects.
973
+
*`:delete`, when the object is destroyed, all its associated objects will be
974
+
deleted directly from the database without calling their `destroy` method.
976
975
977
976
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