Skip to content

Commit

Permalink
Merge pull request #3326 from mikehollis/deprecate-pushMany
Browse files Browse the repository at this point in the history
Deprecate store.pushMany in favor of store.push
  • Loading branch information
fivetanley committed Jun 13, 2015
2 parents c8f39fd + 2ded421 commit 0d59b9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ember-data/lib/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ Store = Service.extend({
*/
pushMany: function(modelName, datas) {
Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of '+ Ember.inspect(modelName), typeof modelName === 'string');
Ember.deprecate('Using store.pushMany() has been deprecated since store.push() now handles multiple items. You should use store.push() instead.');
var length = datas.length;
var result = new Array(length);

Expand Down
12 changes: 12 additions & 0 deletions packages/ember-data/tests/unit/store/push-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,3 +584,15 @@ test("Calling push with unknown keys should not warn by default", function() {
});
}, /The payload for 'person' contains these unknown keys: \[emailAddress,isMascot\]. Make sure they've been defined in your model./);
});

test("Calling pushMany is deprecated", function() {
var person1, person2;
expectDeprecation(function() {
run(function() {
person1 = { id: 1, firstName: 'John', lastName: 'Smith' };
person2 = { id: 2, firstName: 'Suzie', lastName: 'Q' };

store.pushMany('person', [person1, person2]);
});
}, 'Using store.pushMany() has been deprecated since store.push() now handles multiple items. You should use store.push() instead.');
});

0 comments on commit 0d59b9c

Please sign in to comment.