为Rails使用多个回调(:after_commit)?

时间:2021-06-17 01:20:20

Would there be conflicts if I have multiple callbacks of the same nature in Rails? Like several after_commit for the same model?

如果我在Rails中有多个相同性质的回调会有冲突吗?就像同一型号的几个after_commit一样?

I guess I can join them into one method, but for readability reasons, I would rather not..

我想我可以将它们加入到一种方法中,但出于可读性原因,我宁愿不...

1 个解决方案

#1


17  

No they will be executed one after another

不,他们将被一个接一个地执行

after_commit :callback_one, :callback_two

#1


17  

No they will be executed one after another

不,他们将被一个接一个地执行

after_commit :callback_one, :callback_two