add handling each_serializer when expose a collection of object.#106
add handling each_serializer when expose a collection of object.#106hlxwell wants to merge 3 commits into
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: PersonSerializerWhich 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: UserSerializerIt will give you an error, if you add
:each_serializerit doesn't work.so add the option when
:each_serializerwas used, that means user want to regards the object as a collection.