Backbone.js 未捕获类型错误:无法读取属性';i属性';未定义的

Backbone.js 未捕获类型错误:无法读取属性';i属性';未定义的,backbone.js,backbone-relational,Backbone.js,Backbone Relational,我正在使用关系主干,收到以下错误: Uncaught TypeError: Cannot read property 'idAttribute' of undefined 当我访问show_note路线时 App.Router = Backbone.Router.extend({ routes: { 'note/:_id': 'show_note' }, show_note: function(_id) { console.log('this is the sho

我正在使用关系主干,收到以下错误:

Uncaught TypeError: Cannot read property 'idAttribute' of undefined
当我访问
show_note
路线时

App.Router = Backbone.Router.extend({
  routes: {
    'note/:_id': 'show_note'
  },

  show_note: function(_id) {
    console.log('this is the show_note route for _id: ' + _id);
    var note = new App.Models.Note.findOrCreate({ _id: _id });
    var note_view = new App.Views.main_note({ model: note });
    note.fetch();
  }
});
console.log接收“\u id”。但是当我尝试实例化
var note
时,我收到了错误。我该如何解决这个问题

编辑1

添加注释模型:

App.Models.Note = Backbone.RelationalModel.extend({
  urlRoot: '/notes',
  idAttribute: '_id',
  relations: [{
    type: Backbone.HasMany,
    key: 'tags',
    relatedModel: 'App.Models.Tag',
    reverseRelation: {
      key: 'note',
      includeInJSON: '_id'
    }
  }]
});
编辑2

添加Stacktrace


我通过删除
findOrCreate()
解决了这个问题,并最终检索了模型数据,如下所示:

App.Router = Backbone.Router.extend({
  routes: {
    'note/:_id': 'show_note'
  },

  show_note: function(_id) {
    var note = new App.Models.Note({ _id: _id });
    note.fetch({
      success: function(data) {
        var mainNoteView = new App.Views.main_note({ model: note });
        $('#mainNote').append( mainNoteView.render().el );
      },
      error: function(err) {
        console.log(err);
      }
    });
  }
});

您可以显示您的Models.note定义吗?您在全局范围内是否有
App.Models.Tag
?是否有堆栈跟踪来跟踪该异常?