Your Teachers
Chris Oliver
Hi, I'm Chris. I'm the creator of GoRails, Hatchbox.io and Jumpstart. I spend my time creating tutorials and tools to help Ruby on Rails developers build apps better and faster.
About This Episode
Enqueuing jobs inside of a database transaction is a common mistake that's now handled for you automatically in Rails 7.2
Notes
Rails uses database transactions in a few places that are invisible to you as the developer. For example, it's easy to use the wrong ActiveRecord callback like after_create
that enqueues a job before the new record is committed to the database.
In this lesson, we're going to take a look at this issue in Rails 7.1 and upgrade to 7.2 to see the new configuration option handles this situation for us. It's a much welcomed improvement that is one less thing you have to worry about when reviewing code with your team!