-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for heterogenous lists? #335
Comments
Alba currently does not support this kind of feature. You can use I've come up with the new API below: class FooResource
# Resource for Foo
end
class BarResource
# Resource for Bar
end
Alba.serialize([foo, bar], each_resource: true) # => Use FooResource and BarResource The new |
Yea that seems to make sense. I've personally got a workaround working using a single resource type for both actual types, but this would definitely be cleaner. |
@felixwatts I'm interested in how you workaround this problem, could you share the code? |
I'm closing this issue since there's some workaround. I feel I can implement it when finding a high demand of this feature, so feel free to add some comments if you want this feature. |
Is your feature request related to a problem? Please describe.
I need to implement an API that returns a single JSON list containing items of multiple types.
If heterogenous lists are already supported I can't find any documentation on how to use that feature.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: