The way I learned it was that async: false
means that Ember Data expects to already have the related data as part of the original request, and async: true
means it will need to make an additional request to get it (but it won’t necessarily make that request automatically).
In a simple relationship, where a User hasMany
Stuff,
stuff: DS.hasMany('stuff', {async: false})
then Ember Data is expecting a request for User to get something like this in response:
{
stuff: [ { id: 1, user_id: 1 }, { id: 2, user_id: 1 }, { id: 3, user_id: 1 } ],
user: { id: 1, stuff_id: [1, 2, 3] }
}
but if the relationship was
stuff: DS.hasMany('stuff', {async: true})
then Ember Data is just expecting this:
{
user: { id: 1, stuff_id: [1, 2, 3] }
}
…and if you load the user and ask for user.get('stuff')
then it will make a separate request for its related Stuff objects. So it may be more helpful to think of the async:
value not as telling Ember Data how to fetch things, but as telling Ember Data how to expect things from the server.
I’ve only recently tangled with this, though, so I’d be happy to be corrected if I have it wrong.