You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upserting, the very next save on the resulting record does not persist
MyModel.find_by(uuid: 1234)# nilrecord=MyModel.new# (id, uuid, name, age)record.uuid=1234# uuid is the upsert_keyresult=record.upsert# creates record with uuid 1234result.update(name: "foo")persisted=MyModel.find_by(uuid: 1234)persisted.name# nilresult.update(age: 42)persisted=MyModel.find_by(uuid: 1234)persisted.age# 42
The first upsert does an INSERT ON CONFLICT generating the record
The very next update tries to update every column UPDATE "my_model" SET "id" = $1, "name" = $2 ...
Then the update after that does the usual UPDATE "my_model" SET "age" = $1 ...
The text was updated successfully, but these errors were encountered:
After upserting, the very next save on the resulting record does not persist
The first upsert does an
INSERT ON CONFLICT
generating the recordThe very next update tries to update every column
UPDATE "my_model" SET "id" = $1, "name" = $2 ...
Then the update after that does the usual
UPDATE "my_model" SET "age" = $1 ...
The text was updated successfully, but these errors were encountered: