1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Niall Burkley 2015-09-29 17:26:02 +02:00
parent 97b980b4e6
commit 391043ab04

View file

@ -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.