Replies: 1 comment 1 reply
-
|
@dreyks Maybe this one? https://github.com/okuramasafumi/alba/blob/main/README.md#params-override |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I have an association where I want a different child structure depending on a certain state of the parent. I cannot use the Rails inverse association because my parent
belongs_tothe child, so the child itself doesn't know which parent it was called fromThe association's
resourceblock only receives the child, not the parent; the association's main block is executed in the context of an empty proxy serializer, so no access to the parent; thesourceblock does have access to the parent instance, but not the child resourceFor now, i ended up forgoing the association entirely, and just using a custom attribute
but this looks a bit clumsy. I feel like I'm missing something obvious 😅
Beta Was this translation helpful? Give feedback.
All reactions