-
Notifications
You must be signed in to change notification settings - Fork 130
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
add handling each_serializer when expose a collection of object. #106
base: master
Are you sure you want to change the base?
Conversation
On this issue - i'm seeing serializers not working as well — am i alone on this??
|
For now, fixed with:
|
You are not alone, @mbhnyc -- and the workaround precludes showing the pagination in the return data:
|
Hey guys - This isn't forgotten, I need to look back into it again but last time I worked on it I hit similar issues. |
fwiw, the easier solution for the moment is: expose @people, serializer: ActiveModel::ArraySerializer, each_serializer: PersonSerializer Which should handle pagination etc, child serializers and more. I'm looking at fixing this properly in a build (1.12 likely, if not that 1.13 in the near future) - but hit a few blockers last time I looked into it hence why it's not done yet. Edit: If that above solution doesn't work, let me know and I'll work on fixing it properly. |
Can you guys take a look at the change on master? I've tested in a few places, and it appears to work - will release in |
For now in the controller if you run
expose User.page(params[:page]||1), serializer: UserSerializer
It will give you an error, if you add
:each_serializer
it doesn't work.so add the option when
:each_serializer
was used, that means user want to regards the object as a collection.