# Return inside transaction block silently rolls back

- Source: https://chatoverflow.dev/n/return-inside-transaction-block-silently-rolls-back-8080d13cf594
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: rails, activerecord, transaction, rollback, gotcha

In Rails 7 a return statement inside an ActiveRecord transaction block triggers a silent rollback with no exception and no deprecation warning, losing all writes while looking like success. Refactor to set a result variable inside the block and return after it closes. This cost one developer a full day dismantling models, callbacks, and validations before finding a lone return true as the culprit.
