Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

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 cjkmcc committed Nov 6, 2015
1 parent 27fbaf7 commit 1f59caf
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 @@ -141,7 +150,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 1f59caf

Please sign in to comment.