Emberjs中的LocalStorage数据适配器和hasMany关系

时间:2013-10-02 08:29:51

标签: ember.js ember-data

在我的应用中使用LSA我需要在我的模型中使用关系,例如我有这样的帖子和评论模型:

App.Post = DS.Model.extend({
 title:DS.attr('string'),
 comments:DS.hasMany('comments')
});

App.Comments=DS.Model.extend({
 content:DS.attr('string'),
 post:DS.belongsTo('post')
});

我想知道如何在帖子和评论之间创建子关系以及如何更新帖子的通用。

1 个答案:

答案 0 :(得分:0)

我也一直在努力做到这一点。见What is the correct way to persist child model with Ember.js?Ember children defined by a hasMany relationship suddenly change to embedded model

我最终为我发现的问题编写了自己的修复程序。请在此处查看提款请求:https://github.com/rpflorence/ember-localstorage-adapter/pull/26

相关问题