Exposing data of the managed relationship

I created an action on Resource1 that creates another Resource2. Resource2 is created correctly using manage_relationship but I need to return the generated id for Resource2 and I have not found a way to get that information. Is it possible to access the return values from the action called by manage_relationship ? If they are accesible I could put them into metadata
4 Replies
ZachDaniel
ZachDaniel3y ago
You could do an after_action hook that looks at the relationship and sets the id from the new value of the relationship?
barnabasj
barnabasjOP3y ago
Ah, seems I looked in the wrong place again. I did a quick test and if I saw this correctly the relationship will only hold the newly created data on a has_many realtionship, not all related resources. This would work perfectly for me, just wanting to make sure.
ZachDaniel
ZachDaniel3y ago
I don't actually recall if we ensure the relationship is loaded after editing it
barnabasj
barnabasjOP3y ago
KK, gonna take a look at the code and see if I can figure this out myself.

Did you find this page helpful?