I’m developing an app where I’m retrieving data from my REST api. All my endpoints send models. Except one, that can’t be retrieved as a model. It’s a raw array where the keys are dates and the values are an amount. This raw data is used to display a graph on the front.
Here is an aspect of the endpoint : entities/{id}/stats/
Now the problem is that ember force me to use a model to retrieve it. I managed to put the top level in a model Stat, with attributes comments, visits, etc… The model is being enrich by ember but now I would like to get the raw data inside of these attributes and ember doesn’t allow to do so. It’s expecting a string, number, model etc… but not an array or javascript object. I cannot create a model because the attributes would be random dates.
How can you pass easily to a template such a structure ?
hi @broerse i tried your approach but it’s still show an [object object] to me. Btw, this is my response
Below is the response from my API
"attributes": { "original-data": "{\"name\":\"Foobarz\",\"updated_at\":\"2018-02-27 08:06:14 UTC\"}", "new-data": "{\"name\":\"Foobar\",\"updated_at\":\"2018-02-27 10:55:17 UTC\"}", "event-name": "update", "ip-address": "121.58.000.106", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36", "created-at": "2018-02-27T10:55:17.477Z", "updated-at": "2018-02-27T10:55:17.477Z" },
When i do {{model.eventName}} it show the event-name information which is update. However, when i did the {{model.newData}} it retrun a [object Object]. My question is, how can I display the new-data attribute filed value name and updated_at?
@mikeelemuel I only work with ember-pouch and have never seen your issue. Don’t think I can help with your Adapter. You must do something like this with the raw transform added to your transform folder if it is the raw data you want to see.