aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorwillnet <netwillnet@gmail.com>2017-08-23 16:39:42 +0900
committerwillnet <netwillnet@gmail.com>2017-08-24 10:20:22 +0900
commite35960f15e35b284dd909439e684eded60374414 (patch)
treeb9f001cca7e8a039caab9c7fccdeabda31d936a9 /guides
parentd1281cdc2c11ebf26a4e040b02ac1da21f2010a0 (diff)
downloadrails-e35960f15e35b284dd909439e684eded60374414.tar.gz
rails-e35960f15e35b284dd909439e684eded60374414.tar.bz2
rails-e35960f15e35b284dd909439e684eded60374414.zip
[ci skip]Revert commits changing wrong place
This reverts commits 5147ab121d628f29451c654a8c312d5a3f491ffb and 391043ab04007bfd4c4c4c8e8d3308c1eae60175. These commits looked to intend to change documents of has_many dependent options, but actually changed documents of belongs_to dependent options.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.md11
1 files changed, 5 insertions, 6 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index bead931529..c59d0d933b 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -966,13 +966,12 @@ side of the association.
Counter cache columns are added to the containing model's list of read-only attributes through `attr_readonly`.
##### `:dependent`
-Controls what happens to associated objects when their owner is destroyed:
+If you set the `:dependent` option to:
-* `:destroy` causes the associated objects to also be destroyed.
-* `:delete_all` causes the associated objects to be deleted directly from the database (callbacks are not executed).
-* `:nullify` causes the foreign keys to be set to `NULL` (callbacks are not executed).
-* `:restrict_with_exception` causes an exception to be raised if there are associated records.
-* `:restrict_with_error` causes an error to be added to the owner if there are associated objects.
+* `:destroy`, when the object is destroyed, `destroy` will be called on its
+associated objects.
+* `:delete`, when the object is destroyed, all its associated objects will be
+deleted directly from the database without calling their `destroy` method.
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.