Skip to content

Commit

Permalink
[BUGFIX beta] Fix usage of registry for 2.1.0+.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
rwjblue committed Aug 17, 2015
1 parent cea0b0c commit 64ccbc3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/ember-data/lib/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1475,8 +1475,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));
Expand Down

0 comments on commit 64ccbc3

Please sign in to comment.