Follow-up from "Pass group member data from HAML to Vue"
Convert #members_data_json
from a helper to a serializer & entity
The following discussion from !40548 (merged) should be addressed:
-
@mayra-cabrera started a discussion: (+3 comments) Instead of mapping everything
to_json
, what do you think if we create a Serializer and Entity forGroupGroupLink
? With those in place, we would just need to do something like:def linked_groups_data_json(group_links) GroupGroupLinkSerializer.new.represent(group_links) end
Serializer and Entity will look like:
class GroupGroupLinkSerializer < BaseSerializer include WithPagination entity GroupGroupLinkEntity end class GroupLinkEntity < Grape::Entity expose :id expose :group, using: GroupEntity # ... end