Hello,
If I want to inspect a model (by clicking on an instance of a EmberData model) I have the following error:
Ember Inspector has errored.
This is likely a bug in the inspector itself.
You can report bugs at https://github.com/emberjs/ember-inspector.
Error message: Cannot read property 'toString' of undefined
Stack trace: TypeError: Cannot read property 'toString' of undefined
at CoreObject.PrototypeMixin._emberMetalMixin.Mixin.create._Mixin$create.toString (http://localhost:4200/assets/vendor.js:53451:37)
at Object.addListener (http://localhost:4200/assets/vendor.js:34685:88)
at addObserver (http://localhost:4200/assets/vendor.js:38047:23)
at Class.bindPropertyToDebugger (<anonymous>:3244:7)
at <anonymous>:3259:20
at Array.forEach (native)
at <anonymous>:3253:26
at Array.forEach (native)
at Class.bindProperties (<anonymous>:3252:20)
at Class.mixinsForObject (<anonymous>:3203:12)
I'm using
Ember 2.8
Ember-data 2.8.0
Ember Inspector 2.0.3
Which Ember Data version?
the version of Ember-Data is also 2.8.0
I'm unable to reproduce this. Can you reproduce it in jsbin, an online app, or a public repo?
Hello,
This error appear when we use these models:
// model/base.js
import Ember from 'ember';
import Model from 'ember-data/model';
export default Model.extend({
modelName: Ember.computed.alias('constructor.modelName')
});
// model/model1.js
import Ember from 'ember';
import Base from './base';
export default Base.extend({
...
});
If we inspect model1 with Ember Inspector, we have the same error. But if we comment modelName CP in Base model, no error...
We use this CP to get the modelName of a polymorphic relationship (see How to get the modelname of a polymorphic relationship belongsto on discuss.emberjs.com) so we can use {{model.ourRelation.modelName}} instead of {{model.ourRelation.content.constructor.modelName}} in templates.
@pbishop16 any progress updates on this?
@rwwagner90 I greatly apologize, but no updates. I am finally hitting a solid steady state on my new job. Will address this week.
@rwwagner90 Delayed, but still in progress.
@pbishop16 please let me know if you need anything from me 馃憤
This is out of scope for now. Please use constructor.modelName instead.
Most helpful comment
Hello,
This error appear when we use these models:
If we inspect
model1with Ember Inspector, we have the same error. But if we commentmodelNameCP inBasemodel, no error...We use this CP to get the
modelNameof a polymorphic relationship (see How to get the modelname of a polymorphic relationship belongsto on discuss.emberjs.com) so we can use{{model.ourRelation.modelName}}instead of{{model.ourRelation.content.constructor.modelName}}in templates.