Skip to content

Commit 61f2d24

Browse files
committed
Include param should always reference array in docs
1 parent 3ec0359 commit 61f2d24

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Diff for: guides/requests/examples/0-basic-usage.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ import fetch from './fetch';
138138

139139
// ... execute a request
140140
const { content: collection } = await fetch.request(query('company', {
141-
include: 'ceo',
141+
include: ['ceo'],
142142
fields: {
143143
company: 'name',
144144
employee: ['name', 'profileImage']
@@ -182,7 +182,7 @@ import { query } from '@ember-data/json-api/request';
182182

183183
// ... execute a request
184184
const { content: collection } = await store.request(query('company', {
185-
include: 'ceo',
185+
include: ['ceo'],
186186
fields: {
187187
company: 'name',
188188
employee: ['name', 'profileImage']
@@ -249,7 +249,7 @@ import fetch from './fetch';
249249
// ... execute a request
250250
try {
251251
const result = await fetch.request(query('company', {
252-
include: 'ceo',
252+
include: ['ceo'],
253253
fields: {
254254
company: 'name',
255255
employee: ['name', 'profileImage']

Diff for: packages/store/src/-private/store-service.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ export class Store extends BaseClass {
12571257
```app/routes/post.js
12581258
export default class PostRoute extends Route {
12591259
model(params) {
1260-
return this.store.findRecord('post', params.post_id, { include: 'comments' });
1260+
return this.store.findRecord('post', params.post_id, { include: ['comments'] });
12611261
}
12621262
}
12631263
```
@@ -1284,15 +1284,17 @@ export class Store extends BaseClass {
12841284
In this case, the post's comments would then be available in your template as
12851285
`model.comments`.
12861286
1287-
Multiple relationships can be requested using an `include` parameter consisting of a
1288-
comma-separated list (without white-space) while nested relationships can be specified
1289-
using a dot-separated sequence of relationship names. So to request both the post's
1287+
Multiple relationships can be requested using an `include` parameter consisting
1288+
of a list of relationship names, while nested relationships can be specified using a
1289+
dot-separated sequence of relationship names. So to request both the post's
12901290
comments and the authors of those comments the request would look like this:
12911291
12921292
```app/routes/post.js
12931293
export default class PostRoute extends Route {
12941294
model(params) {
1295-
return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });
1295+
return this.store.findRecord('post', params.post_id, {
1296+
include: ['comments', 'comments.author']
1297+
});
12961298
}
12971299
}
12981300
```
@@ -1909,19 +1911,19 @@ export class Store extends BaseClass {
19091911
```app/routes/posts.js
19101912
export default class PostsRoute extends Route {
19111913
model() {
1912-
return this.store.findAll('post', { include: 'comments' });
1914+
return this.store.findAll('post', { include: ['comments'] });
19131915
}
19141916
}
19151917
```
19161918
Multiple relationships can be requested using an `include` parameter consisting of a
1917-
comma-separated list (without white-space) while nested relationships can be specified
1919+
list of relationship names, while nested relationships can be specified
19181920
using a dot-separated sequence of relationship names. So to request both the posts'
19191921
comments and the authors of those comments the request would look like this:
19201922
19211923
```app/routes/posts.js
19221924
export default class PostsRoute extends Route {
19231925
model() {
1924-
return this.store.findAll('post', { include: 'comments,comments.author' });
1926+
return this.store.findAll('post', { include: ['comments', 'comments.author'] });
19251927
}
19261928
}
19271929
```

0 commit comments

Comments
 (0)