I want to create a post model with a nested/embedded model author. The following code gives me the error:
Error while processing route: index Assertion Failed: You cannot add a
‘undefined’ record to the ‘post.author’. You can only add a ‘author’
record to this relationship. Error: Assertion Failed: You cannot add a
‘undefined’ record to the ‘post.author’. You can only add a ‘author’
record to this relationship.
@skaterdav85 did you figure this one out? I’m searching for a solution for the same problem. A new (parent) record is being created that will have multiple new records. When the parent record is created, it will also create the other records on the server side.
@Garrick If each of the nested objects is considered a resource and you want to treat it as a model, you will have to store.createRecord for each one. However, if you are creating a single resource and the backend happens to expect some attributes with nested objects, then no, you don’t need to do that. Creating a bunch of different types of resources at once doesn’t really fit into the typical REST semantics.