-
Notifications
You must be signed in to change notification settings - Fork 538
Open
Description
If I were updating / creating a "post" and I also wanted to create / update tag id 3 in the example below, should that be possible (i.e. similar to nested attributes in active record).
Probably a bit of a bad example, but hopefully you get the idea ?
I am finding that each entry in "data" in the relationships must only contain id and type. Nowhere have I yet seen how to do this in json_api in general, not just in this gem so maybe it is not possible. In which case, I guess I would need to create / update the tag seperately, but then I may need to worry about rolling it back if the creation / update of the post did not succeed etc...
post '/posts',
{
'posts' => {
'attributes' => {
'title' => 'A great new Post'
},
'relationships' => {
'tags' => {
'data' => [
{type: 'tags', id: 3, attributes: {name: "New Tag Name"}},
{type: 'tags', id: 4}
]
}
}
}
}
zernie, nicooga and danhmanh
Metadata
Metadata
Assignees
Labels
No labels