Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated how we describe injecting Ember Data store #1541

Merged
merged 3 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions guides/release/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,18 @@ identifier, instead):
Ember Data is a powerful (but optional) library included by default in new Ember apps.
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/release/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/).

_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/release/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/release/classes/Route/methods/model?anchor=model) hook._
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the reader hasn't seen the code yet, I thought it'd be better to move this paragraph (an afterthought about Model vs. model()) after we present the code.


```javascript {data-filename=app/routes/favorite-posts.js}
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class FavoritePostsRoute extends Route {
@service store;
model() {
return this.store.findAll('posts');
}
}
```

Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/release/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/release/classes/Route/methods/model?anchor=model) hook.

## Multiple Models

What should you do if you need the `model` to return the results of multiple API requests?
Expand Down
6 changes: 2 additions & 4 deletions guides/v3.15.0/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,18 @@ identifier, instead):
Ember Data is a powerful (but optional) library included by default in new Ember apps.
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/3.15/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/).

_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.15/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.15/classes/Route/methods/model?anchor=model) hook._

```javascript {data-filename=app/routes/favorite-posts.js}
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class FavoritePostsRoute extends Route {
@service store;
model() {
return this.get('store').findAll('posts');
}
}
```

Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.15/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.15/classes/Route/methods/model?anchor=model) hook.

## Multiple Models

What should you do if you need the `model` to return the results of multiple API requests?
Expand Down
6 changes: 2 additions & 4 deletions guides/v3.16.0/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,18 @@ identifier, instead):
Ember Data is a powerful (but optional) library included by default in new Ember apps.
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/3.16/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/).

_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.16/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.16/classes/Route/methods/model?anchor=model) hook._

```javascript {data-filename=app/routes/favorite-posts.js}
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class FavoritePostsRoute extends Route {
@service store;
model() {
return this.get('store').findAll('posts');
}
}
```

Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.16/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.16/classes/Route/methods/model?anchor=model) hook.

## Multiple Models

What should you do if you need the `model` to return the results of multiple API requests?
Expand Down
6 changes: 2 additions & 4 deletions guides/v3.17.0/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,18 @@ identifier, instead):
Ember Data is a powerful (but optional) library included by default in new Ember apps.
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/3.17/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/).

_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.17/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.17/classes/Route/methods/model?anchor=model) hook._

```javascript {data-filename=app/routes/favorite-posts.js}
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class FavoritePostsRoute extends Route {
@service store;
model() {
return this.store.findAll('posts');
}
}
```

Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.17/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.17/classes/Route/methods/model?anchor=model) hook.

## Multiple Models

What should you do if you need the `model` to return the results of multiple API requests?
Expand Down
6 changes: 2 additions & 4 deletions guides/v3.18.0/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,18 @@ identifier, instead):
Ember Data is a powerful (but optional) library included by default in new Ember apps.
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/3.18/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/).

_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.18/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.18/classes/Route/methods/model?anchor=model) hook._

```javascript {data-filename=app/routes/favorite-posts.js}
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class FavoritePostsRoute extends Route {
@service store;
model() {
return this.store.findAll('posts');
}
}
```

Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.18/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.18/classes/Route/methods/model?anchor=model) hook.

## Multiple Models

What should you do if you need the `model` to return the results of multiple API requests?
Expand Down
6 changes: 2 additions & 4 deletions guides/v3.19.0/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,18 @@ identifier, instead):
Ember Data is a powerful (but optional) library included by default in new Ember apps.
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/3.19/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/).

_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.19/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.19/classes/Route/methods/model?anchor=model) hook._

```javascript {data-filename=app/routes/favorite-posts.js}
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class FavoritePostsRoute extends Route {
@service store;
model() {
return this.store.findAll('posts');
}
}
```

Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.19/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.19/classes/Route/methods/model?anchor=model) hook.

## Multiple Models

What should you do if you need the `model` to return the results of multiple API requests?
Expand Down
6 changes: 2 additions & 4 deletions guides/v3.20.0/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,18 @@ identifier, instead):
Ember Data is a powerful (but optional) library included by default in new Ember apps.
In the next example, we will use Ember Data's [`findAll`](https://api.emberjs.com/ember-data/3.20/classes/Store/methods/findAll?anchor=findAll) method, which returns a Promise, and resolves with an array of [Ember Data records](../../models/).

_Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.20/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.20/classes/Route/methods/model?anchor=model) hook._

```javascript {data-filename=app/routes/favorite-posts.js}
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class FavoritePostsRoute extends Route {
@service store;
model() {
return this.store.findAll('posts');
}
}
```

Note that Ember Data also has a feature called a [`Model`](https://api.emberjs.com/ember-data/3.20/classes/Model), but it's a separate concept from a route's [`model`](https://api.emberjs.com/ember/3.20/classes/Route/methods/model?anchor=model) hook.

## Multiple Models

What should you do if you need the `model` to return the results of multiple API requests?
Expand Down