Description
I'm hitting a post endpoint for a resource that has a relation. To use your example, it would be much like posting a user that has data for two chocolates.
I notice that the resource user
gets created, but not the associated chocolates
.
I am now doubting that this is even possible and would love it if you could confirm one way or the other. When I look at your example for a post, I see that there is no payload for the association:
https://github.com/manyminds/api2go/blob/master/examples/crud_example_test.go#L60
On my end, I've debugged enough to see that when SetToManyReferenceIDs
is called, the IDs
that are passed in are correct in number (there are two associations and there are two IDs
), but they are set to zero. This makes sense because at this point create
hasn't been called yet.
When create
does get called, I inspect the obj
and the array for the association (which would be chocolates
) is empty. If it wasn't empty I could grab the data and save it to the db.
I have implemented all the interfaces to make associations work, at least I'm pretty sure I have.