rails/railties/lib
Jean Boussier 5fbaa524b9 Active Record commit transaction on return, break and throw
Fix: https://github.com/rails/rails/issues/45017
Ref: https://github.com/rails/rails/pull/29333
Ref: https://github.com/ruby/timeout/pull/30

Historically only raised errors would trigger a rollback, but in Ruby `2.3`, the `timeout` library
started using `throw` to interupt execution which had the adverse effect of committing open transactions.

To solve this, in Active Record 6.1 the behavior was changed to instead rollback the transaction as it was safer
than to potentially commit an incomplete transaction.

Using `return`, `break` or `throw` inside a `transaction` block was essentially deprecated from Rails 6.1 onwards.

However with the release of `timeout 0.4.0`, `Timeout.timeout` now raises an error again, and Active Record is able
to return to its original, less surprising, behavior.
2023-07-10 10:37:42 +02:00
..
minitest Add Oxford commas [ci-skip] 2022-02-21 11:11:11 -06:00
rails Active Record commit transaction on return, break and throw 2023-07-10 10:37:42 +02:00
rails.rb 🔗 Remove RDoc auto-link from Rails module everywhere 2023-06-23 10:49:30 +09:00