I try to make repost with relation on original post. I use objects of the same model.
Ember: 2.2.0
Ember Data: v2.3.0
models/post.js
export default DS.Model.extend({
text: DS.attr('string'),
originalPost: DS.belongsTo('post', {async: false})
});
If I create repost with link on original post
let post = this.store.createRecord('post', {
text: 'post'
});
let repost = this.store.createRecord('post', {
text: 'repost',
originalPost: post
});
I've got cross reference i.e.: nested post in repost as expected and nested repost in post as I don't expect.
repost.get('originalPost') -> post
post.get('originalPost') -> repost ???
Who can explain this behavior and how I can avoid this to create only one directional relation?
Thanks!
Aucun commentaire:
Enregistrer un commentaire