Understanding after_update callback in Rails 4

前端 未结 2 2043
傲寒
傲寒 2020-12-31 17:21

I have a Rails object with after_update callback that sends a record to a queue. And the problem is that I noticed sometimes the queue is being processed faster

2条回答
  •  自闭症患者
    2020-12-31 18:15

    after_save, after_create, after_update are called within the transaction block, so they will be executed before executing the SQL statement.

    If you want to do something when the statement execution is completed, you should use after_commit callback.

提交回复
热议问题