From 1f59caf4db0a384bbecfd216841f4c400ad5e219 Mon Sep 17 00:00:00 2001 From: Jonathan Goldman Date: Thu, 14 May 2015 16:05:31 -0400 Subject: [PATCH] Compatability with Ember 1.11 and 1.12 `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: https://github.com/emberjs/ember.js/pull/10672 https://github.com/emberjs/ember-inspector/pull/327 --- packages/ember-model/lib/model.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/ember-model/lib/model.js b/packages/ember-model/lib/model.js index 83a6d0a..511b934 100644 --- a/packages/ember-model/lib/model.js +++ b/packages/ember-model/lib/model.js @@ -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, { @@ -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;