"with_after_commit" 是什么,为什么我找不到它的任何信息?

What is "with_after_commit" and why can't I find anything about it?

我帮助开发了来自 Rails 4(我不太熟悉)的测试套件,并且有一些测试在其声明中包含 "with_after_commit: true"。

经过一些修改后,我删除了它,测试套件 运行 快了一点。

它也在 rails_helper.rb 中使用,就像这样: Why after_commit not running even with use_transactional_fixtures = false

问题是:我找不到任何关于它的信息来证明它的使用是合理的。我只在上面的线程中找到对它的引用。

谢谢!

您要查找的是名为 after_commit 的 ActiveRecord 回调,而不是 with_after_commit(这只是您的测试用例的名称)。

它被记录在案 here,如果您 Google 它,您可以找到大量资源。

看看Active Record Callbacks Guide也不错。