diff --git a/TRANSITION.md b/TRANSITION.md index 77320bc870f..9fc893926d2 100644 --- a/TRANSITION.md +++ b/TRANSITION.md @@ -456,7 +456,7 @@ resulting payload is sent through the following hooks: 1. The payload is sent to `extractSingle` if the original request was for a single record (like `find`/`save`) or `extractArray` if the original request was for an Array of records (like - `findAll`/`findQuery`) + `findAll`/`query`) 2. The default behavior of those methods is to pull apart the top-level of the payload into multiple smaller records. 3. Each of those smaller records is sent to `normalize`, which can do @@ -587,7 +587,7 @@ of `"id"`: "_id": "1", "author_name": "DHH", "title": "Rails is omakase", - "comments": [ "1", "2" ] + "comments": [ "1", "2" ] }, "comments": [{ "_id": "1", diff --git a/packages/ember-data/lib/system/store.js b/packages/ember-data/lib/system/store.js index 1b34e691ec6..d14bc36dcca 100644 --- a/packages/ember-data/lib/system/store.js +++ b/packages/ember-data/lib/system/store.js @@ -940,7 +940,7 @@ Store = Service.extend({ var adapter = this.adapterFor(modelName); Ember.assert("You tried to load a query but you have no adapter (for " + typeClass + ")", adapter); - Ember.assert("You tried to load a query but your adapter does not implement `query`", typeof adapter.query === 'function' || typeof adapter.findQuery === 'function'); + Ember.assert("You tried to load a query but your adapter does not implement `query`", typeof adapter.query === 'function'); return promiseArray(_query(adapter, this, typeClass, query, array)); }, diff --git a/packages/ember-data/lib/system/store/finders.js b/packages/ember-data/lib/system/store/finders.js index 16e912196c3..3b30b793427 100644 --- a/packages/ember-data/lib/system/store/finders.js +++ b/packages/ember-data/lib/system/store/finders.js @@ -142,7 +142,7 @@ export function _query(adapter, store, typeClass, query, recordArray) { var promise = adapter.query(store, typeClass, query, recordArray); var serializer = serializerForAdapter(store, adapter, modelName); - var label = "DS: Handle Adapter#findQuery of " + typeClass; + var label = "DS: Handle Adapter#query of " + typeClass; promise = Promise.resolve(promise, label); promise = _guard(promise, _bind(_objectIsAlive, store)); @@ -158,7 +158,7 @@ export function _query(adapter, store, typeClass, query, recordArray) { recordArray.loadRecords(records); return recordArray; - }, null, "DS: Extract payload of findQuery " + typeClass); + }, null, "DS: Extract payload of query " + typeClass); } export function _queryRecord(adapter, store, typeClass, query) { diff --git a/packages/ember-data/tests/integration/adapter/rest-adapter-test.js b/packages/ember-data/tests/integration/adapter/rest-adapter-test.js index 6b08f06d683..10da5cf9fd2 100644 --- a/packages/ember-data/tests/integration/adapter/rest-adapter-test.js +++ b/packages/ember-data/tests/integration/adapter/rest-adapter-test.js @@ -1074,7 +1074,7 @@ test("findAll - data is normalized through custom serializers", function() { })); }); -test("findQuery - if `sortQueryParams` option is not provided, query params are sorted alphabetically", function() { +test("query - if `sortQueryParams` option is not provided, query params are sorted alphabetically", function() { adapter.ajax = function(url, verb, hash) { passedUrl = url; passedVerb = verb; @@ -1090,7 +1090,7 @@ test("findQuery - if `sortQueryParams` option is not provided, query params are })); }); -test("findQuery - passes buildURL the requestType", function() { +test("query - passes buildURL the requestType", function() { adapter.buildURL = function(type, id, snapshot, requestType) { return "/" + requestType + "/posts"; }; @@ -1106,7 +1106,7 @@ test("findQuery - passes buildURL the requestType", function() { })); }); -test("findQuery - if `sortQueryParams` is falsey, query params are not sorted at all", function() { +test("query - if `sortQueryParams` is falsey, query params are not sorted at all", function() { adapter.ajax = function(url, verb, hash) { passedUrl = url; passedVerb = verb; @@ -1124,7 +1124,7 @@ test("findQuery - if `sortQueryParams` is falsey, query params are not sorted at })); }); -test("findQuery - if `sortQueryParams` is a custom function, query params passed through that function", function() { +test("query - if `sortQueryParams` is a custom function, query params passed through that function", function() { adapter.ajax = function(url, verb, hash) { passedUrl = url; passedVerb = verb; @@ -1151,7 +1151,7 @@ test("findQuery - if `sortQueryParams` is a custom function, query params passed })); }); -test("findQuery - payload 'meta' is accessible on the record array", function() { +test("query - payload 'meta' is accessible on the record array", function() { ajaxResponse({ meta: { offset: 5 }, posts: [{ id: 1, name: "Rails is very expensive sushi" }] @@ -1166,7 +1166,7 @@ test("findQuery - payload 'meta' is accessible on the record array", function() })); }); -test("findQuery - each record array can have it's own meta object", function() { +test("query - each record array can have it's own meta object", function() { ajaxResponse({ meta: { offset: 5 }, posts: [{ id: 1, name: "Rails is very expensive sushi" }] @@ -1190,7 +1190,7 @@ test("findQuery - each record array can have it's own meta object", function() { }); -test("findQuery - returning an array populates the array", function() { +test("query - returning an array populates the array", function() { ajaxResponse({ posts: [ { id: 1, name: "Rails is omakase" }, @@ -1226,7 +1226,7 @@ test("findQuery - returning an array populates the array", function() { })); }); -test("findQuery - returning sideloaded data loads the data", function() { +test("query - returning sideloaded data loads the data", function() { ajaxResponse({ posts: [ { id: 1, name: "Rails is omakase" }, @@ -1242,7 +1242,7 @@ test("findQuery - returning sideloaded data loads the data", function() { })); }); -test("findQuery - data is normalized through custom serializers", function() { +test("query - data is normalized through custom serializers", function() { env.registry.register('serializer:post', DS.RESTSerializer.extend({ primaryKey: '_ID_', attrs: { name: '_NAME_' } diff --git a/packages/ember-data/tests/unit/adapters/rest-adapter/deprecated-adapter-methods.js b/packages/ember-data/tests/unit/adapters/rest-adapter/deprecated-adapter-methods.js deleted file mode 100644 index 90f55bf98ae..00000000000 --- a/packages/ember-data/tests/unit/adapters/rest-adapter/deprecated-adapter-methods.js +++ /dev/null @@ -1,35 +0,0 @@ -var store = {}; -var type = 'post'; -var id = 1; -var snapshot = {}; - -module("unit/adapters/rest-adapter/deprecated-adapter-methods - "); - -test("`findRecord` delegates to deprecated find method if it is supplied", function() { - expect(2); - - var adapter = DS.RESTAdapter.extend({ - find: function() { - ok(true, 'overridden `find` method should be called'); - } - }).create(); - - expectDeprecation(function() { - adapter.findRecord(store, type, id, snapshot); - }, /RestAdapter#find has been deprecated and renamed to `findRecord`./); -}); - - -test("`query` delegates to deprecated findQuery method if it is supplied", function() { - expect(2); - - var adapter = DS.RESTAdapter.extend({ - findQuery: function() { - ok(true, 'overridden `findQuery` method should be called'); - } - }).create(); - - expectDeprecation(function() { - adapter.query(store, type, id, snapshot); - }, /RestAdapter#findQuery has been deprecated and renamed to `query`./); -});