RelationalModel
を利用したいと思いますrequireJs
。
ここに私のコード(*)
モジュールを実行すると、次の警告メッセージが表示されます。
Relation=d;
no model, key or relatedModel (function (){a.apply(this,arguments)},
"tasks",
undefined).
私の質問は次のとおりです。
1) 警告メッセージは何を意味しますか?
2)relatedModel
とcollectionType
は自分で明確に定義されていますか、relations
それとも と をエクスポートする必要がありmodel
ますか?collection
define
(*)
define([
'backbone',
'relationalModel'
], function (Backbone) {
"use strict";
var User = Backbone.RelationalModel.extend({
relations: [{
type: Backbone.HasMany,
key: 'tasks',
relatedModel: 'Task',
collectionType: 'TaskCollection',
reverseRelation: {
key: 'hasUser',
includeInJSON: 'id'
// 'relatedModel' is automatically set to 'User'; the 'relationType' to 'HasOne'.
}
}]
});
return User;
});