Skip to content

Commit

Permalink
Rename findByRecord to findRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroicEric committed Jun 7, 2015
1 parent ab81251 commit a00e731
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions packages/ember-data/lib/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ Store = Service.extend({
return this.findQuery(modelName, id);
}

return this.findByRecord(modelName, coerceId(id), preload);
return this.findRecord(modelName, coerceId(id), preload);
},

/**
Expand Down Expand Up @@ -614,21 +614,21 @@ Store = Service.extend({
@return {Promise} promise
*/
findById: function(modelName, id, preload) {
Ember.deprecate('Using store.findById() has been deprecated. Use store.findByRecord() to return a record for a given type and id combination.');
return this.findByRecord(modelName, id, preload);
Ember.deprecate('Using store.findById() has been deprecated. Use store.findRecord() to return a record for a given type and id combination.');
return this.findRecord(modelName, id, preload);
},

/**
This method returns a record for a given type and id combination.
@method findByRecord
@method findRecord
@private
@param {String} modelName
@param {(String|Integer)} id
@param {Object} preload - optional set of attributes and relationships passed in either as IDs or as actual models
@return {Promise} promise
*/
findByRecord: function(modelName, id, preload) {
findRecord: function(modelName, id, preload) {
Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of '+ Ember.inspect(modelName), typeof modelName === 'string');
var internalModel = this._internalModelForId(modelName, id);

Expand All @@ -649,7 +649,7 @@ Store = Service.extend({
fetchedInternalModel = internalModel._loadingPromise;
}

return promiseRecord(fetchedInternalModel || internalModel, "DS: Store#findByRecord " + internalModel.typeKey + " with id: " + get(internalModel, 'id'));
return promiseRecord(fetchedInternalModel || internalModel, "DS: Store#findRecord " + internalModel.typeKey + " with id: " + get(internalModel, 'id'));
},
/**
This method makes a series of requests to the adapter's `find` method
Expand All @@ -666,12 +666,12 @@ Store = Service.extend({
var store = this;

return promiseArray(Ember.RSVP.all(map(ids, function(id) {
return store.findByRecord(modelName, id);
return store.findRecord(modelName, id);
})).then(Ember.A, null, "DS: Store#findByIds of " + modelName + " complete"));
},

/**
This method is called by `findByRecord` if it discovers that a particular
This method is called by `findRecord` if it discovers that a particular
type/id pair hasn't been loaded yet to kick off a request to the
adapter.
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-data/tests/integration/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ test("store.findById() is deprecated", function() {
store.findById('person', 1);
});
},
'Using store.findById() has been deprecated. Use store.findByRecord() to return a record for a given type and id combination.'
'Using store.findById() has been deprecated. Use store.findRecord() to return a record for a given type and id combination.'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test("Calling Store#find invokes its adapter#find", function() {
});
});

test("Calling Store#findByRecord multiple times coalesces the calls into a adapter#findMany call", function() {
test("Calling Store#findRecord multiple times coalesces the calls into a adapter#findMany call", function() {
expect(2);

var adapter = TestAdapter.extend({
Expand Down

0 comments on commit a00e731

Please sign in to comment.