diff --git a/guides/release/models/relationships.md b/guides/release/models/relationships.md index d7a456a6e4..46fbc9e06c 100644 --- a/guides/release/models/relationships.md +++ b/guides/release/models/relationships.md @@ -256,6 +256,28 @@ And our API might setup these relationships like so: } ``` +### Accessing related data + +When accessing ember-data relationships in your app, you can either ask for the related record asynchronously or synchronously. + +It's possible to configure it through the ` async` option. The default value is `true`. + +```javascript {data-filename=app/models/organization.js} +import Model, { hasMany } from '@ember-data/model'; + +export default class OrganizationModel extends Model { + @hasMany('membership', { async: false }) memberships; +} +``` + +Thus, later in your app, you will be able to access the relationship like so: + +```javascript +let memberships = organization.get('memberships'); +``` + +For more information, you can [check out the official documentation on async relationships.](https://api.emberjs.com/ember-data/release/functions/@ember-data%2Fmodel/hasMany) + ### Readonly Nested Data Some models may have properties that are deeply nested objects of