一个旧项目升级到 rails7,代码中的事务部分竟然跳过不执行了?难道还有什么开关设置? 数据库是 mysql,模式是 InnoDB
begin
puts 0
ActiveRecord::Base.transaction do
puts 0
a = dish_order.update!(status: :checkouted, pay_at: DateTime.now, payment_method: :abpay)
......
render json: { code: 0, message: '支付成功', data: { } }, status: :ok and return
end
rescue => e
render json: { code: 1, message: e, data: {} }, status: :ok and return
end