简体   繁体   English

我们如何获取ActiveRecord事务中的创建/更新/回滚记录数

[英]How do we get the number of create/update/rollback records in a ActiveRecord transaction

In a ActiveRecord transaction block, how do I get to know the number of records that were created/updated/rollbacked? 在ActiveRecord事务块中,我如何知道已创建/更新/回滚的记录数? for specific model. 针对特定型号。

This information is needed to know the history of what happened during the transaction job and report to the user. 需要此信息来了解交易工作期间发生的事情的历史并向用户报告。

A transaction either succeeds entirely, or fails and the database is rolled back to the state before the transaction. 事务要么完全成功,要么失败,并且数据库回滚到事务之前的状态。

There is no notion of partial completion for a transaction. 没有交易的部分完成的概念。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM