Cannot read property 'has' of undefined

I like to try the new ember-data canary serialize: true but get Error while processing route: pages.index Cannot read property 'has' of undefined TypeError: Cannot read property 'has' of undefined

What is ‘has’?

Code that gives me this error:

I hope someone can point me in the right direction.

It’s due to some change that happened in ED after beta.18. Perhaps there is a bug in ember-pouch due to the ember-data changes. It seems to not throw this error on 18 but does on 19.1 and 19.2

We have Pouch in production with 19.2 but have not seen this error. Have you tried it with my code. I like to know if the new serialize: true works on the hasMany. Perhaps the has in the error is from this hasMany?

The same exception happens here with ember-pouch 2.0.1 and Ember(-Data) 1.13.0. The data schema that brings up the error is:

DS.belongsTo('somethingElse', {async: true}):

without the serialize: true attribute. The code line where things goes wrong looks like

if (!Ember.get(type, 'attributes').has('rev'))

in ember-pouch.

The type in Ember.get(type, 'attributes') should be an model object, but actually is a string when an relationship is used inside your model. I think this needs some investigation on the ember-pouch side.

After looking into the code for a while now I found out that the ember-pouch adapter iterates over the relationships of a model with help of DS.Model.eachRelationship. Each time an init method is called with the passed in descriptors type attribute.

The documentation states, that the type attribute is a model, but actually appears to be a string. This looks to me like a bug in Ember-Data.

Thanks. I have looked to and why my ember-data 19.2 in production does not give me this error. It tuns out we don’t use hasMany in that project. If it is an ember-data thing how do we report it?

I reported it here. Let’s see, what happens.