Skip to content

Commit

Permalink
Merge pull request #3829 from HeroicEric/remove-references-to-find-query
Browse files Browse the repository at this point in the history
Remove references to findQuery
  • Loading branch information
bmac committed Oct 8, 2015
2 parents 083b406 + 8f83fbf commit 724b100
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 49 deletions.
4 changes: 2 additions & 2 deletions TRANSITION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -587,7 +587,7 @@ of `"id"`:
"_id": "1",
"author_name": "DHH",
"title": "Rails is omakase",
"comments": [ "1", "2" ]
"comments": [ "1", "2" ]
},
"comments": [{
"_id": "1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-data/lib/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-data/lib/system/store/finders.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
};
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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" }]
Expand All @@ -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" }]
Expand All @@ -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" },
Expand Down Expand Up @@ -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" },
Expand All @@ -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_' }
Expand Down

This file was deleted.

0 comments on commit 724b100

Please sign in to comment.