Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate store.pushMany in favor of store.push #3326

Merged
merged 1 commit into from
Jun 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.');
});