Skip to content

Commit

Permalink
Compatability with Ember 1.11 and 1.12
Browse files Browse the repository at this point in the history
`Ember.Descriptor` has gone the way of the dodo in ember. This was stolen
from the ember inspector and makes everything work again. See the
following for more information:

emberjs/ember.js#10672
emberjs/ember-inspector#327
  • Loading branch information
Jonathan Goldman authored and ef4 committed Aug 21, 2015
1 parent 02167b5 commit 8243b3b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/ember-model/lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ function hasCachedValue(object, key) {
}
}

function isDescriptor(value) {
// Ember < 1.11
if (Ember.Descriptor !== undefined) {
return value instanceof Ember.Descriptor;
}
// Ember >= 1.11
return value && typeof value === 'object' && value.isDescriptor;
}

Ember.run.queues.push('data');

Ember.Model = Ember.Object.extend(Ember.Evented, {
Expand Down Expand Up @@ -138,7 +147,7 @@ Ember.Model = Ember.Object.extend(Ember.Evented, {
},

didDefineProperty: function(proto, key, value) {
if (value instanceof Ember.Descriptor) {
if (isDescriptor(value)) {
var meta = value.meta();
var klass = proto.constructor;

Expand Down

0 comments on commit 8243b3b

Please sign in to comment.