Skip to content

Commit

Permalink
Merge pull request #3615 from HeroicEric/update-query-record-example
Browse files Browse the repository at this point in the history
[DOC release] Update misleading example for Adapter.queryRecord()
  • Loading branch information
bmac committed Aug 3, 2015
2 parents 3366e85 + 39a42ad commit f989308
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/ember-data/lib/system/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,16 @@ var Adapter = Ember.Object.extend({
Example
```javascript
App.ApplicationAdapter = DS.Adapter.extend({
queryRecord: function(store, typeClass, query) {
var url = [type.typeKey, id].join('/');
```app/adapters/application.js
import DS from 'ember-data';
import Ember from 'ember';
export default DS.Adapter.extend(DS.BuildURLMixin, {
queryRecord: function(store, type, query) {
var urlForQueryRecord = this.buildURL(type.modelName, null, null, 'queryRecord', query);
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.getJSON(url, query).then(function(data) {
Ember.$.getJSON(urlForQueryRecord, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Expand All @@ -220,7 +223,6 @@ var Adapter = Ember.Object.extend({
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {Object} query
@param {String} id
@return {Promise} promise
*/
queryRecord: null,
Expand Down

0 comments on commit f989308

Please sign in to comment.