From 64016357e3717f56f9a06333b634f96fe3179988 Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Thu, 5 May 2022 16:26:47 +0200 Subject: [PATCH 1/6] Update doc regarding async relationships Adding doc hints for async relationships as discussed on discord: https://discord.com/channels/480462759797063690/480777444203429888/971550923124002916 --- guides/release/models/relationships.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/guides/release/models/relationships.md b/guides/release/models/relationships.md index d7a456a6e4..da0eb24c7d 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 relationship + +When accessing ember-data relationship in your app, you can either ask for accessing the relation asynchronously or synchronously. + +It's possible to configure it through the `{ async: boolean }` property. + +```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 about async relationships, you can [check out the official documentation.](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 From 10f80a54961a5210a194491d3e7b66e7180526a6 Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Mon, 9 May 2022 14:15:59 +0200 Subject: [PATCH 2/6] Update guides/release/models/relationships.md Mention default value Co-authored-by: Joao Da Silva Marly --- guides/release/models/relationships.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/release/models/relationships.md b/guides/release/models/relationships.md index da0eb24c7d..6ae02688de 100644 --- a/guides/release/models/relationships.md +++ b/guides/release/models/relationships.md @@ -260,7 +260,7 @@ And our API might setup these relationships like so: When accessing ember-data relationship in your app, you can either ask for accessing the relation asynchronously or synchronously. -It's possible to configure it through the `{ async: boolean }` property. +It's possible to configure it through the `{ async: boolean }` property. The default value is `true`. ```javascript {data-filename=app/models/organization.js} import Model, { hasMany } from '@ember-data/model'; From f0d55bd23700e631c2cc9cf5bd80aa169ada30b6 Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Fri, 3 Jun 2022 20:34:46 +0200 Subject: [PATCH 3/6] Update guides/release/models/relationships.md Co-authored-by: Jen Weber --- guides/release/models/relationships.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/release/models/relationships.md b/guides/release/models/relationships.md index 6ae02688de..734fcea0d9 100644 --- a/guides/release/models/relationships.md +++ b/guides/release/models/relationships.md @@ -258,7 +258,7 @@ And our API might setup these relationships like so: ### Accessing relationship -When accessing ember-data relationship in your app, you can either ask for accessing the relation asynchronously or synchronously. +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: boolean }` property. The default value is `true`. From 4cb1dc3057a04a50a6d94171b667bb253af2403e Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Fri, 3 Jun 2022 20:35:05 +0200 Subject: [PATCH 4/6] Update guides/release/models/relationships.md Co-authored-by: Jen Weber --- guides/release/models/relationships.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/release/models/relationships.md b/guides/release/models/relationships.md index 734fcea0d9..2cf4c34f63 100644 --- a/guides/release/models/relationships.md +++ b/guides/release/models/relationships.md @@ -260,7 +260,7 @@ And our API might setup these relationships like so: 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: boolean }` property. The default value is `true`. +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'; From 7a0d22c88e6dbdf89561847012c29c9808357436 Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Fri, 3 Jun 2022 20:35:22 +0200 Subject: [PATCH 5/6] Update guides/release/models/relationships.md Co-authored-by: Jen Weber --- guides/release/models/relationships.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/release/models/relationships.md b/guides/release/models/relationships.md index 2cf4c34f63..93e1c33454 100644 --- a/guides/release/models/relationships.md +++ b/guides/release/models/relationships.md @@ -276,7 +276,7 @@ Thus, later in your app, you will be able to access the relationship like so: let memberships = organization.get('memberships'); ``` -For more information about async relationships, you can [check out the official documentation.](https://api.emberjs.com/ember-data/release/functions/@ember-data%2Fmodel/hasMany) +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 From 363d67acc253a5264cd7c3325797e0bdaacd6128 Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Mon, 6 Jun 2022 18:28:25 +0200 Subject: [PATCH 6/6] Update guides/release/models/relationships.md Co-authored-by: Jen Weber --- guides/release/models/relationships.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/release/models/relationships.md b/guides/release/models/relationships.md index 93e1c33454..46fbc9e06c 100644 --- a/guides/release/models/relationships.md +++ b/guides/release/models/relationships.md @@ -256,7 +256,7 @@ And our API might setup these relationships like so: } ``` -### Accessing relationship +### Accessing related data When accessing ember-data relationships in your app, you can either ask for the related record asynchronously or synchronously.