DEV Community 👩‍💻👨‍💻

Discussion on: TIL: Using Different Database Connection with ActiveRecord Transactions

edgarortegaramirez profile image
Edgar Ortega • Edited on

Hmm no, the error raised inside the transaction block will force the transaction to rollback, but ActiveRecord will re-raise the same error, here I'm rescuing after the rollback has occurred, then re-raising again. If you don't need to re-raise the error again you can simply omit it.

Thread Thread
amrrbakry profile image
Amr El-Bakry Author

that is a great solution. I don't know why I haven't thought of that :D Thank you so much, Edgar!