From 0f6e11093dd0b6ed07305cf3859670a5d9abcb28 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Mon, 17 Aug 2015 11:46:43 -0400 Subject: [PATCH 1/2] [BUGFIX beta] Fix usage of registry for 2.1.0+. Using `registry.resolve` is generally private API, and `container.lookupFactory` provides roughly the same result. We still need the registry to actually register the model we create, so I added a small matrix inline (this was the only usage of accessing the registry off of `this.container` that I found in the codebase). (cherry picked from commit 64ccbc34511e2dda830fc1ce96bb21c247edceb4) --- packages/ember-data/lib/system/store.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/ember-data/lib/system/store.js b/packages/ember-data/lib/system/store.js index 345a47b98c4..bd4c5cc7ae1 100644 --- a/packages/ember-data/lib/system/store.js +++ b/packages/ember-data/lib/system/store.js @@ -1742,8 +1742,11 @@ Store = Service.extend({ _modelForMixin: function(modelName) { var normalizedModelName = normalizeModelName(modelName); - var registry = this.container._registry ? this.container._registry : this.container; - var mixin = registry.resolve('mixin:' + normalizedModelName); + // container.registry = 2.1 + // container._registry = 1.11 - 2.0 + // container = < 1.11 + var registry = this.container.registry || this.container._registry || this.container; + var mixin = this.container.lookupFactory('mixin:' + normalizedModelName); if (mixin) { //Cache the class as a model registry.register('model:' + normalizedModelName, DS.Model.extend(mixin)); From f92d07f2419916b909f99ec74993722ea437209a Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Mon, 17 Aug 2015 12:48:46 -0400 Subject: [PATCH 2/2] Fix invalid `_super` call. This was previously passing, because Ember 2.0.0 and lower did not properly rethrow the error in all circumstances. (cherry picked from commit b6498c4f47e0031f5bfebc385bd29cb62667c947) --- packages/ember-data/tests/unit/many-array-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ember-data/tests/unit/many-array-test.js b/packages/ember-data/tests/unit/many-array-test.js index e9257b41c55..f1bddd58a68 100644 --- a/packages/ember-data/tests/unit/many-array-test.js +++ b/packages/ember-data/tests/unit/many-array-test.js @@ -103,13 +103,13 @@ test("manyArray trigger arrayContentChange functions with the correct values", f willChangeStartIdx = startIdx; willChangeRemoveAmt = removeAmt; willChangeAddAmt = addAmt; - return this._super.apply(arguments); + return this._super.apply(this, arguments); }, arrayContentDidChange: function(startIdx, removeAmt, addAmt) { equal(startIdx, willChangeStartIdx, 'WillChange and DidChange startIdx should match'); equal(removeAmt, willChangeRemoveAmt, 'WillChange and DidChange removeAmt should match'); equal(addAmt, willChangeAddAmt, 'WillChange and DidChange addAmt should match'); - return this._super.apply(arguments); + return this._super.apply(this, arguments); } }); run(function() {