Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

update models section to reflect renamed store methods #345

Merged
merged 1 commit into from
Jul 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 6 additions & 6 deletions source/models/finding-records.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The Ember Data store provides a simple interface for finding records of a single
type through the `store` object's `find` method. Internally, the `store`
uses `find`, `findAll`, and `findQuery` based on the supplied arguments.
uses either `findAll` or `findRecord` based on the supplied arguments.

The first argument to `store.find()` is always the record type. The optional second
argument determines if a request is made for all records, a single record, or a query.
argument determines if a request is made for all records or just a single record.
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this behavior deprecated and people should use findAll? @bmac

Copy link
Member

Choose a reason for hiding this comment

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

Those are being updated separately #346


### Finding All Records of a Type

Expand Down Expand Up @@ -40,15 +40,15 @@ var aSinglePost = this.store.find('post', 1); // => GET /posts/1

### Querying For Records

If you provide a plain object as the second argument to `find`, Ember Data will
make a `GET` request with the object serialized as query params. This method returns
`DS.PromiseArray` in the same way as `find` with no second argument.
Ember Data provides the ability to query for records that meet certain criteria. Calling `store.query()`
will make a `GET` request with the passed object serialized as query params. This method returns
`DS.PromiseArray` in the same way as `find`.

For example, we could search for all `person` models who have the name of
`Peter`:

```javascript
var peters = this.store.find('person', { name: "Peter" }); // => GET to /persons?name=Peter
var peters = this.store.query('person', { name: "Peter" }); // => GET to /persons?name=Peter
```

### Integrating with the Route's Model Hook
Expand Down
2 changes: 1 addition & 1 deletion source/models/handling-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Along with the records returned from your store, you'll likely need to handle so
Pagination is a common example of using metadata. Imagine a blog with far more posts than you can display at once. You might query it like so:

```js
var result = this.store.find("post", {
var result = this.store.query("post", {
limit: 10,
offset: 0
});
Expand Down
2 changes: 1 addition & 1 deletion source/routing/query-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default Ember.Route.extend({

// params has format of { category: "someValueOrJustNull" },
// which we can just forward to the server.
return this.store.findQuery('articles', params);
return this.store.query('articles', params);
}
});
```
Expand Down