let blogPost = this.get('store').peekRecord('blog-post', 1);
let comment = this.get('store').createRecord('comment', {
});
blogPost.get('comments').pushObject(comment);
comment.save().then(function () {
blogPost.save();
});
With: TypeError: blogPost.get(...).pushObject is not a function
the following example also didnt work for me also when the record is saved:
For example, if you want to set the author property of a blogPost, this would not work if the user with id isn't already loaded into the store:
this.get('store').createRecord('blog-post', {
title: 'Rails is Omakase',
body: 'Lorem ipsum',
author: this.get('store').findRecord('user', 1)
});
I think that there should be at least an .save() at the end for a full example and for users who want to copy and paste and try it out.
I also find out that the following doesn't work
let blogPost = this.get('store').peekRecord('blog-post', 1);
let comment = this.get('store').createRecord('comment', {
blogPost: blogPost
});
comment.save();
===================================
there aren't any examples for users who want to create her relationships like an working example:
written at https://guides.emberjs.com/v3.0.0/models/relationships/ this is not working:
the following example also didnt work for me also when the record is saved:
I think that there should be at least an .save() at the end for a full example and for users who want to copy and paste and try it out.
I also find out that the following doesn't work
=================================== there aren't any examples for users who want to create her relationships like an working example:
by the way.. my question: is that the only way to do that ?
Thanks