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

[DOC] Add documentation for query#update() to refresh query #4592

Merged
merged 1 commit into from
Oct 20, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,33 @@ var get = Ember.get;
may trigger a search on the server, whose results would be loaded
into an instance of the `AdapterPopulatedRecordArray`.

---

If you want to update the array and get the latest records from the
adapter, you can invoke [`update()`](#method_update):

Example

```javascript
// GET /users?isAdmin=true
var admins = store.query('user', { isAdmin: true });

admins.then(function() {
console.log(admins.get("length")); // 42
});

// somewhere later in the app code, when new admins have been created
// in the meantime
//
// GET /users?isAdmin=true
admins.update().then(function() {
admins.get('isUpdating'); // false
console.log(admins.get("length")); // 123
});

admins.get('isUpdating'); // true
```

@class AdapterPopulatedRecordArray
@namespace DS
@extends DS.RecordArray
Expand Down
3 changes: 2 additions & 1 deletion addon/-private/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,8 @@ Store = Service.extend({
Parameters: { "ids" => ["1", "2", "3"] }
```

This method returns a promise, which is resolved with a `RecordArray`
This method returns a promise, which is resolved with an
[`AdapterPopulatedRecordArray`](http://emberjs.com/api/data/classes/DS.AdapterPopulatedRecordArray.html)
once the server returns.

@since 1.13.0
Expand Down