DEV Community

Rails `after_commit` everywhere

Vladimir Dementyev on February 21, 2018

Recently I've released a new gem–Isolator, which helps to detect non-database side effects during a database transaction. Here is a quick example ...
Collapse
 
ben profile image
Ben Halpern

@andy this seems like something to bookmark for possible use in the future.

Collapse
 
andy profile image
Andy Zhao (he/him)

This is some next level Ruby stuff. Definitely a great use case! Thanks for the post.

Collapse
 
akostadinov profile image
Aleksandar Kostadinov

Is it better than the after_commit_queue [1] gem? Seems like this one is decoupled from model being saved. Which might be expected and desirable or unexpected.

[1] github.com/Ragnarson/after_commit_...

Collapse
 
palkan_tula profile image
Vladimir Dementyev

Yes, this gem is better. It uses Active Record APIs (thus, battle-tested) and not a custom queue implementation.

Collapse
 
envek profile image
Andrey Novikov

I've extracted this into the gem: github.com/Envek/after_commit_ever...

Collapse
 
iridakos profile image
Lazarus Lazaridis

Cool gem!