mercredi 29 juillet 2015

How to handle partially embedded records?

I've been having some trouble using Ember Data with my MongoDB back-end. Let's say I have a User model, which contains a Media (the user picture). Sometimes user.picture is sent embed, sometimes the back-end only sends the Media ID.

How do I handle that with Ember Data? I haven't seen anything like this in the EmbeddedRecordsMixin, even if I think it's kinda easy to do (if it's an object, don't fetch it, if it's a string, fetch the corresponding object).




Aucun commentaire:

Enregistrer un commentaire