Closed distracteddev closed 10 years ago
I am going to create a guide for custom serialization soon. If you are using the latest version of EPF (more recent than this issue), it should be as simple as:
App.PostSerializer = Epf.JsonSerializer.extend({
properties: {
id: {
key: '_id'
}
}
});
Going to close the issue, but please reopen if you are still having issues.
@ghempton I'm currently updating my app to the latest version of EPF and am running into some issues here. I'll dig down further once I find some time but the issue seems to stem from the fact the model-specific serializers are not being used on deserialization.
Given your example above, upon receiving post data from the server, the RestAdapter
never calls serializerFor
. Thus, when JsonSerializer#keyFor
calls configFor
, it looks up properties
directly on JsonSerializer
as opposed to PostSerializer
, and returns undefined rather than '_id' as it should.
I apologize for the lack of detail. I'll put together a failing test as soon as I can get some time. Just wanted to bring this to your attention first in case I am misunderstanding the way the new serializers work.
I've looked everywhere in the RestAdapter and Serializer code and even after following the documented method for setting a primary key at https://github.com/GroupTalent/epf/blob/master/lib/serializer/serializer.js#L85
it still doesn't work :(