This blog is part of our Rails 6 series.
Rails 6.0 was recently released.
Rails 6 fixes a
callbacks are called on failed update in a transaction block.
Let’s checkout the bug in Rails 5.2 and the fix in Rails 6.
Let’s define an
User model and try updating an
invalid user object in a transaction block.
As we can see here, that that the after_commit callback
was called even if object was never saved in the transaction.
Now, let’s try the same thing in Rails 6.
Now, we can see that after_commit callback was never called if the object was
Here is the relevant