本文介绍了如何找到ActiveRecord ROLLBACK的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在日志中,我看到 ROLLBACK,但没有记录异常.有没有办法找出导致回滚的原因?

In the logs I'm seeing a ROLLBACK, but no exception is logged. Is there a way to find out what caused the ROLLBACK?

这是日志的摘录:

  Phone Load (0.4ms)  SELECT "phones".* FROM "phones" WHERE "phones"."id" = $1 LIMIT 1  [["id", 980190963]]
   (0.2ms)  BEGIN
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."phone_id" = 980190963 LIMIT 1
   (0.2ms)  ROLLBACK
  Phone Load (0.4ms)  SELECT "phones".* FROM "phones" WHERE "phones"."id" = $1 LIMIT 1  [["id", 980190963]]
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."phone_id" = 980190963 LIMIT 1

推荐答案

save record with BANG '!'所以它会产生一个运行时错误,你会知道它发生在哪里

save record with BANG '!' so it will make a run time error and you get know where does it happens

这篇关于如何找到ActiveRecord ROLLBACK的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 09:35