From 39a42adf2e08a2658d444a19d5786f84c4ec7e6a Mon Sep 17 00:00:00 2001 From: Eric Kelly Date: Thu, 30 Jul 2015 17:28:13 -0400 Subject: [PATCH] [DOC release] Update misleading example for Adapter.queryRecord() --- packages/ember-data/lib/system/adapter.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/ember-data/lib/system/adapter.js b/packages/ember-data/lib/system/adapter.js index 506accd7cd4..2eb234cd9a1 100644 --- a/packages/ember-data/lib/system/adapter.js +++ b/packages/ember-data/lib/system/adapter.js @@ -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 @@ -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,