Is it possible to embed and include related objects using ActiveModel :: Serializer?
We are in a weird situation where we have a limb-supported point that includes data and lateral loads. I have no idea why it was built this way, and why no one thought hey, we seem to be sending all of this data twice
, but explaining the reasons why the former stewards of our code is the task of Sisyphus.
I am rewriting the JSON output currently by hand to use serializers because removing useless code is good news. However, I cannot imagine two questions:
1) There seems to be no way to embed an object as well as load it. I know I can disconnect by setting embed :ids, include: true
, but this only returns ids
side-loaded objects from the parent relation.
2) Is there a way not to set a status embeds
for each relationship? It seems like the only way to set something sideways or inline is with a string embed :ids...
, but that affects everything that is a relation. How can I get more granular control over attachment / upload?
source to share
No one has answered this question yet
Check out similar questions: