My Setup
DEBUG: -------------------------------
DEBUG: Ember : 1.5.1
DEBUG: Ember Data : 1.0.0-beta.8.2a68c63a
DEBUG: Handlebars : 1.3.0
DEBUG: jQuery : 1.11.0
DEBUG: -------------------------------
I understand ember-data by default wants "sideloaded relationships".
http://emberjs.com/guides/models/the-rest-adapter/#toc_sideloaded-relationships
It simply doesn't make any sense to me why they would choose to design their REST adapter as such. Regardless I've seen some posts that suggest I can embed the relationships:
- https://stackoverflow.com/a/14324532/1251349
- http://discuss.emberjs.com/t/ember-data-embedded-records-handling/4132
However can't seem to get it to work. The answer's I've found are of older versions of emberjs. So I'm not sure if I'm doing something wrong, or the old solutions no longer work.
TL:DR; Does ember-data still support "embedded relationships"
Here is an example of what I got:
GDL.Event = DS.Model.extend(
title: DS.attr('string')
time: DS.attr('date')
time_i: DS.attr('number')
live: DS.attr('boolean')
category: { embedded: 'load' }
)
GDL.Category = DS.Model.extend(
name: DS.attr('string')
)
My JSON
{
"events":[
{
"id":2411,
"title":"Green Bay Packers vs. Seattle Seahawks",
"time":"2014-09-05T00:30:00.000Z",
"time_i":1409877000,
"category":{
"id":109,
"name":"Football"
}
},
{
"id":2412,
"title":"New Orleans Saints vs. Atlanta Falcons",
"time":"2014-09-07T17:00:00.000Z",
"time_i":1410109200,
"category":{
"id":109,
"name":"Football"
}
},
]
}