@johnnyicon wrote:
Is there a way to load a subclass data model into a superclass’s route?
As an example, I have a superclass named
Vehicle
and a subclass namedCar
.I have route like this:
/vehicle/21/edit
And in this instance,
Vehicle #21
is aCar
. Accrodingly, my API returns the following payload data:{"car": {/* lots of data */}}
When the route
vehicle.edit
tries to load this data, I get the following error:Error while processing route: vehicle.edit payload.data is null
I can work around this by changing my API so that it uses
vehicle
as the root node in the JSON response, but I was wondering if Ember has a way to automatically cast a subclass into a superclass (e.g., load thecar
JSON response into aVehicle
instance).Thanks in advance!
Posts: 1
Participants: 1