diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-10-30 00:16:30 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-30 00:16:30 +0900 |
commit | d7f48c9c39befaf23ccd63e0248a3bd5bf295ee5 (patch) | |
tree | e8c05ad3b1704d054721e9cf1202b7f48e7261b4 | |
parent | 0d68e0690f449bf815c975c25d4d74917d3cad11 (diff) | |
parent | 20ea01bd649138c46460995a3e565471b8386945 (diff) | |
download | rails-d7f48c9c39befaf23ccd63e0248a3bd5bf295ee5.tar.gz rails-d7f48c9c39befaf23ccd63e0248a3bd5bf295ee5.tar.bz2 rails-d7f48c9c39befaf23ccd63e0248a3bd5bf295ee5.zip |
Merge pull request #34338 from malclocke/document_exception_class_for_restrict_with_exception
Document exception from restrict_with_exception [ci skip]
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 4 | ||||
-rw-r--r-- | guides/source/association_basics.md | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index ab1e7ad269..fb1df00dc8 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1294,7 +1294,7 @@ module ActiveRecord # * <tt>:destroy</tt> causes all the associated objects to also be destroyed. # * <tt>:delete_all</tt> causes all the associated objects to be deleted directly from the database (so callbacks will not be executed). # * <tt>:nullify</tt> causes the foreign keys to be set to +NULL+. Callbacks are not executed. - # * <tt>:restrict_with_exception</tt> causes an exception to be raised if there are any associated records. + # * <tt>:restrict_with_exception</tt> causes an <tt>ActiveRecord::DeleteRestrictionError</tt> exception to be raised if there are any associated records. # * <tt>:restrict_with_error</tt> causes an error to be added to the owner if there are any associated objects. # # If using with the <tt>:through</tt> option, the association on the join model must be @@ -1437,7 +1437,7 @@ module ActiveRecord # * <tt>:destroy</tt> causes the associated object to also be destroyed # * <tt>:delete</tt> causes the associated object to be deleted directly from the database (so callbacks will not execute) # * <tt>:nullify</tt> causes the foreign key to be set to +NULL+. Callbacks are not executed. - # * <tt>:restrict_with_exception</tt> causes an exception to be raised if there is an associated record + # * <tt>:restrict_with_exception</tt> causes an <tt>ActiveRecord::DeleteRestrictionError</tt> exception to be raised if there is an associated record # * <tt>:restrict_with_error</tt> causes an error to be added to the owner if there is an associated object # # Note that <tt>:dependent</tt> option is ignored when using <tt>:through</tt> option. diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 78a1f47407..f75517c5ab 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -1258,7 +1258,7 @@ Controls what happens to the associated object when its owner is destroyed: * `:destroy` causes the associated object to also be destroyed * `:delete` causes the associated object to be deleted directly from the database (so callbacks will not execute) * `: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_exception` causes an `ActiveRecord::DeleteRestrictionError` 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 It's necessary not to set or leave `:nullify` option for those associations @@ -1659,7 +1659,7 @@ Controls what happens to the associated objects when their owner is destroyed: * `:destroy` causes all the associated objects to also be destroyed * `:delete_all` causes all the associated objects to be deleted directly from the database (so callbacks will not execute) * `:nullify` causes the foreign keys to be set to `NULL`. Callbacks are not executed. -* `:restrict_with_exception` causes an exception to be raised if there are any associated records +* `:restrict_with_exception` causes an `ActiveRecord::DeleteRestrictionError` exception to be raised if there are any associated records * `:restrict_with_error` causes an error to be added to the owner if there are any associated objects ##### `:foreign_key` |