diff options
author | Niall Burkley <niallburkley@gmail.com> | 2015-09-29 17:26:02 +0200 |
---|---|---|
committer | Niall Burkley <niallburkley@gmail.com> | 2015-09-29 17:34:27 +0200 |
commit | 391043ab04007bfd4c4c4c8e8d3308c1eae60175 (patch) | |
tree | 70012883f24cd8912d405f1dab9a35f6ab3d36a5 /guides/source/association_basics.md | |
parent | 97b980b4e61aea3cee429bdee4b2eae2329905cd (diff) | |
download | rails-391043ab04007bfd4c4c4c8e8d3308c1eae60175.tar.gz rails-391043ab04007bfd4c4c4c8e8d3308c1eae60175.tar.bz2 rails-391043ab04007bfd4c4c4c8e8d3308c1eae60175.zip |
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
Diffstat (limited to 'guides/source/association_basics.md')
-rw-r--r-- | guides/source/association_basics.md | 5 |
1 files changed, 4 insertions, 1 deletions
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. |