@ultimatelocal wrote:
On my
route.js
I have a line of code that isreturn this.store.findAll(
auditTrail)
so on mytemplate.hbs
<tr class="animated fadeIn"> <td>{{auditTrail.eventName}}</td> </tr> {{/each}}
However, it returns nothing. This is my api endpoint
/audit-trails/41?include=audit-trailable
. My question, is there something wrong on myroute.js
or the way I define my model? Btw, this is my model. Please see model beloweventName: DS.attr('string'), ipAddress: DS.attr('string'), userAgent: DS.attr('string'), createdAt: DS.attr('date'), deliveredAt: DS.attr('date')
Ideally it should return something right. Below is the response I get when I was using Postman (edited)
"data": { "id": 2, "type": "audit-trails", "attributes": { "original-data": "{\"name\":\"PowerMacz\",\"updated_at\":\"2018-02-27 08:06:14 UTC\"}", "new-data": "{\"name\":\"PowerMac\",\"updated_at\":\"2018-02-27 10:55:17 UTC\"}", "event-name": "update", "ip-address": "121.58.201.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" }, "relationships": { "user": { "links": { "related": "https://myUrl.com/api/v1/audit-trails/2/user" }, "data": { "type": "users", "id": 1 } }, "audit-trailable": { "links": { "related": "https://myUrl.com/api/v1/audit-trails/2/audit-trailable" }, "data": { "type": "shops", "id": 2 } } }, "links": { "self": "https://myUrl.com/api/v1/audit-trails/2" } }, "included": [ { "id": 2, "type": "shops", "attributes": { "name": "PowerMac", "created-at": "2016-02-02T19:04:04.360Z", "updated-at": "2018-03-09T16:15:23.630Z" }, "relationships": { "locations": { "links": { "related": "https://myUrl.com/api/v1/shops/2/locations" }, "data": [ { "type": "locations", "id": 200 }, { "type": "locations", "id": 201 }, { "type": "locations", "id": 202 }, { "type": "locations", "id": 203 }, { "type": "locations", "id": 204 }, { "type": "locations", "id": 205 }, { "type": "locations", "id": 206 }, { "type": "locations", "id": 207 }, { "type": "locations", "id": 208 } ] }, "areas": { "links": { "related": "https://myUrl.com/api/v1/shops/2/areas" }, "data": [ { "type": "areas", "id": 1 }, { "type": "areas", "id": 4 }, { "type": "areas", "id": 5 }, { "type": "areas", "id": 6 }, { "type": "areas", "id": 8 }, { "type": "areas", "id": 2 }, { "type": "areas", "id": 3 }, { "type": "areas", "id": 7 }, { "type": "areas", "id": 9 } ] }, "business-hours": { "links": { "related": "https://myUrl.com/api/v1/shops/2/business-hours" } }, "pickup-addresses": { "links": { "related": "https://myUrl.com/api/v1/shops/2/pickup-addresses" }, "data": [ { "type": "pickup-addresses", "id": 43 }, { "type": "pickup-addresses", "id": 21 }, { "type": "pickup-addresses", "id": 44 }, { "type": "pickup-addresses", "id": 45 } ] }, "departments": { "links": { "related": "https://myUrl.com/api/v1/shops/2/departments" }, "data": [ { "type": "departments", "id": 47 }, { "type": "departments", "id": 50 }, { "type": "departments", "id": 6 }, { "type": "departments", "id": 5 } ] }, "categories": { "links": { "related": "https://myUrl.com/api/v1/shops/2/categories" }, "data": [ { "type": "categories", "id": 68 } ] }, "promotions": { "links": { "related": "https://myUrl.com/api/v1/shops/2/promotions" }, "data": [ { "type": "promotions", "id": 253 } ] }, "job-orders": { "links": { "related": "https://myUrl.com/api/v1/shops/2/job-orders" } }, "banners": { "links": { "related": "https://myUrl.com/api/v1/shops/2/banners" } }, "billing-rates": { "links": { "related": "https://myUrl.com/api/v1/shops/2/billing-rates" }, "data": [ { "type": "billing-rates", "id": 3 } ] } }, "links": { "self": "https://myUrl.com/api/v1/shops/2" } } ] }```
Posts: 1
Participants: 1