Skip to content

Commit cb6a365

Browse files
authored
Merge pull request rails#47640 from a5-stable/add-record-not-destroyed
Update documentation about exception handling in destroy callbacks
2 parents dda3e02 + 6e469c1 commit cb6a365

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

guides/source/active_record_callbacks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ throw :abort
343343

344344
WARNING. Any exception that is not `ActiveRecord::Rollback` or `ActiveRecord::RecordInvalid` will be re-raised by Rails after the callback chain is halted. Additionally, may break code that does not expect methods like `save` and `update` (which normally try to return `true` or `false`) to raise an exception.
345345

346+
NOTE: If an `ActiveRecord::RecordNotDestroyed` is raised within `after_destroy`, `before_destroy` or `around_destroy` callback, it will not be re-raised and the `destroy` method will return `false`.
347+
346348
Relational Callbacks
347349
--------------------
348350

0 commit comments

Comments
 (0)