Ember.js & Ember Data: How to create record with hasMany relationship when the parent and child don't exist yet

前端 未结 2 1584
萌比男神i
萌比男神i 2020-12-23 11:39

As seems to be the case with most everything I do with ember-data the simple test case is very simple but anything \"real\" falls apart quickly due to my lack of understandi

2条回答
  •  不思量自难忘°
    2020-12-23 12:11

    In case anyone else is getting to this late, the current documentation points out that you can simply call createRecord() like this:

    post.get('comments').createRecord({})

    which works even if post is an empty object.

提交回复
热议问题