From 391043ab04007bfd4c4c4c8e8d3308c1eae60175 Mon Sep 17 00:00:00 2001 From: Niall Burkley Date: Tue, 29 Sep 2015 17:26:02 +0200 Subject: Fix documentation for has_many dependant options. * 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 --- guides/source/association_basics.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'guides/source') diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 60790b33a4..999c533fb3 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -932,8 +932,11 @@ If you set the `:dependent` option to: * `: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 +* `:delete_all`, when the object is destroyed, all its associated objects will be deleted directly from the database without calling their `destroy` method. +* `:nullify`, causes the foreign key to be set to `NULL`. Callbacks are not executed. +* `:restrict_with_exception`, causes an exception to be raised if there is an associated record +* `:restrict_with_error`, causes an error to be added to the owner if there is an associated object 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. -- cgit v1.2.3