data
data copied to clipboard
Mistake in documentation of the serialize method
The documentation of serialize indicates that includeId is true when serializing for createRecord and not when updateRecord, which is true only when using the REST adapter:
// serializeIntoHash has the following signature and uses serialize behind:
function serializeIntoHash(store, modelClass, snapshot, options = { includeId: true })
// Creating
const data = serializeIntoHash(store, type, snapshot);
[...]
// Updating. Options are overridden and includeId is here considered `false`.
const data = serializeIntoHash(store, type, snapshot, {});
but not the JSON API one:
// Creating, same as REST
[...]
// Updating
const data = serializeIntoHash(store, type, snapshot);
I'd like to update the documentation with a PR, but I wonder what I should do:
- remove the paragraph "The adapter passes in
includeId: truewhen serializing a record forcreateRecord, but not forupdateRecord." - mention how both REST and JSON API adapters behave.
I think this is a situation where the documentation needs to be "copied forward". Each class should have it's own docs for all the methods even though some of them are shared and not re-implemented.