gitlab-org--gitlab-foss/app/serializers/group_serializer.rb
Dmitriy Zaporozhets 5bce197b61
Serialize groups as json for Dashboard::GroupsController
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-05-04 23:45:02 +03:00

19 lines
395 B
Ruby

class GroupSerializer < BaseSerializer
entity GroupEntity
def with_pagination(request, response)
tap { @paginator = Gitlab::Serializer::Pagination.new(request, response) }
end
def paginated?
@paginator.present?
end
def represent(resource, opts = {})
if paginated?
super(@paginator.paginate(resource), opts)
else
super(resource, opts)
end
end
end