Skip to content

Commit 391043a

Browse files
committed
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
1 parent 97b980b commit 391043a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

guides/source/association_basics.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,11 @@ If you set the `:dependent` option to:
932932

933933
* `:destroy`, when the object is destroyed, `destroy` will be called on its
934934
associated objects.
935-
* `:delete`, when the object is destroyed, all its associated objects will be
935+
* `:delete_all`, when the object is destroyed, all its associated objects will be
936936
deleted directly from the database without calling their `destroy` method.
937+
* `:nullify`, causes the foreign key to be set to `NULL`. Callbacks are not executed.
938+
* `:restrict_with_exception`, causes an exception to be raised if there is an associated record
939+
* `:restrict_with_error`, causes an error to be added to the owner if there is an associated object
937940

938941
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.
939942

0 commit comments

Comments
 (0)