View Full Version : update model after store.sync

16 Nov 2012, 12:50 PM
when sync does a POST to insert record, the data in the response seems to be loaded back into the record. I know this because the id field of the record is set after the sync.

I was expecting this same thing to happen on a PUT. I have a version column in my model that needs to be incremented each time that the record is updated on the backend. The version in the response of the PUT is incremented, but it does not get set in the record. If I try to update a second time, the PUT passes the same value of the version field, and it fails on my backend (basic optimistic locking paradigm).

I am wrong to expect the response to be merged back into the record that was updated? If so, how should I go about doing this manually?

17 Nov 2012, 5:30 AM
I had a problem in my reader. My response from the PUT does not include a successProperty. After setting successProperty to false in my JsonReader config, the saved record is updated with the response as expected.

I wonder why the id property of the record was getting updated by the response after a POST even when I had the reader's successProperty wrong?