Same model name, but multiple backends


Hi everyone, I’ve been working to upgrade an Ember app to 1.13, and using new JSON API for Ember Data.

We have a bunch of backends, all of them have a User model. And we all these models on the frontend as well. Until now we’ve separated the backend models into folders named after the backend app, and overwritten the serializers to properly serialize. But because of sideloading, modelNameFromPayloadKey would end up with a gigantic switch inside to tell the model name of each root in payload…

Without having the backends change the “type” attribute on the payloads to add the prefixes, is there another/better way to do it?

The User model is one example, there are couple more that overlap between backends.

Thank you very much in advance.