rails/rails — pull request #16537 by arthurnn (2014-08-18 04:39:52+00:00)
Title: Add option to stop swallowing errors on callbacks.

Seconds take of #14488 .

After the transaction refactor, we can cleanly apply this patch, as we have a better control of the stack of transactions, and we know that even when raising errors, the transaction wont leaky into the stack.

### Description
The current behaviour is to only log errors that happen on
`after_commit` and `after_rollback` callbacks, this commit adds a
option to active record which make those errors actually raise instead
of only be logged.
Example:
```ruby
# For, only, log errors in after_commit/after_rollback callbacks.
config.active_record.errors_in_transactional_callbacks = :log

# For raise errors in after_commit/after_rollback callbacks.
config.active_record.errors_in_transactional_callbacks = :raise
```
The option should be removed in future versions of Rails, as the desired
behaviour is not to swallow exceptions.

[fixes #13460]

review @jonleighton @rafaelfranca @tenderlove @chancancode @senny