aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-11-29 05:23:30 -0800
committerYves Senn <yves.senn@gmail.com>2013-11-29 05:23:30 -0800
commit0322b6a835297741c47200aab3f1364d78d4aaa3 (patch)
tree747767c24477c72b779ee06e93b78f6166d9e99f /guides
parent2f513144f7d538ba154f4f28d5a93bb25d9bc384 (diff)
parent647cff3a134772bc6374b89e95d13497e23b5309 (diff)
downloadrails-0322b6a835297741c47200aab3f1364d78d4aaa3.tar.gz
rails-0322b6a835297741c47200aab3f1364d78d4aaa3.tar.bz2
rails-0322b6a835297741c47200aab3f1364d78d4aaa3.zip
Merge pull request #13095 from kuldeepaggarwal/test-case-updation
removed unnecessary test case
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index c0482f6106..9867d2dc3f 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -864,8 +864,12 @@ end
Counter cache columns are added to the containing model's list of read-only attributes through `attr_readonly`.
##### `:dependent`
+If you set the `:dependent` option to:
-If you set the `:dependent` option to `:destroy`, then deleting this object will call the `destroy` method on the associated object to delete that object. If you set the `:dependent` option to `:delete`, then deleting this object will delete the associated object _without_ calling its `destroy` method. If you set the `:dependent` option to `:restrict`, then attempting to delete this object will result in a `ActiveRecord::DeleteRestrictionError` if there are any 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.