在我的rails日志中,以下(已清理的)SQL正在destroy:
上运行 SQL (0.5ms) DELETE FROM "people" WHERE "people"."id" = $1 [["id", 345]]
SQL (0.4ms) UPDATE "people" SET position = (position - 1) WHERE ("people"."voter_registration_id" = 194 AND "people"."level" = 'state' AND position > 5)
class Person < ActiveRecord::Base
belongs_to :voter_registration, inverse_of: :people
.
.
.
end
可能导致第二条update
行被创建的原因是什么?例如,为什么它会重新排序现有人(原始请求中当前删除的人员位置为5)?