I have a Client
model. When viewing /clients
, I want to return a simple serialization of my clients, with just a few aggregate values (lets say total_unbilled
and total_owing
). When viewing /clients/1
, I want to return a full serialization of the client, including all it's nested tasks and expenses. The back-end has already been configured to do this.
I don't want to return the full serialization of all clients when the user views /clients
, as there can be a lot of data under potentially hundreds of clients. I'd like to load that extra information only when needed, when the user views a particular client.
What's the best way to handle this use-case, where models can be serialized in multiple ways, using Ember Data? I know it will cache the initial representation of the client, so if the user visits /clients
first, it won't ever try to fetch the full serialization of the client if the user then visits /clients/1
. Is there a sensible way to override this? Or would I have to have two different Ember Data models client-side (eg. Client
and MiniClient
)?