问题
I have a Node.js/Geddy app which was working untill a few minutes ago. Now, when I try to run it, I get the following error:
I have many models, but for one of them, I get this error.
The error is shown because in the file whose path is displayed in the console the following is undefined:
reg[ownedModelName]
where
reg = model.descriptionRegistry
and ownedModelName is given by
if (assnKey == 'belongsTo') {
ownerModelName = modelName;
ownedModelName = self.name;
idKey = modelName;
}
else {
ownerModelName = self.name;
ownedModelName = modelName;
idKey = self.name;
}
Actually, I know the value of ownedModelName, but I don't know why reg[ownedModelName] is undefined.
This is how the model which triggers the error looks like:
var RenderingForm = function () {
this.defineProperties({
name: {type: 'string'},
description: {type: 'string'},
mode: {type: 'string'},
helpText: {type: 'string'},
noEvaluation: {type: 'boolean'},
compatibleProblemTypes: {type: 'string'}
});
this.validatesPresent('name');
this.validatesPresent('description');
};
RenderingForm = geddy.model.register('RenderingForm', RenderingForm);
Why is that undefined and how can I solve my problem?
UPDATE:
I've tried to create the same app on another partition, it didn't work, and now when I've tried again to run the old app, I get the same error, but for another model than before.
回答1:
Finally!!! Thanks to THIS I've found out that it was a hasOne() or has Many() with a wrong parameter.
来源:https://stackoverflow.com/questions/15393621/typeerror-cannot-read-property-properties-of-undefined