Commit 1e99b7b5 authored by nmilojevic1's avatar nmilojevic1

Add support for project_members array

parent f1dd55e8
......@@ -47,6 +47,8 @@ module Gitlab
record = exportable.public_send(key) # rubocop: disable GitlabSecurity/PublicSend
if record.is_a?(ActiveRecord::Relation)
serialize_many_relations(key, record, options)
elsif record.respond_to?(:each) # this is to support `project_members` that return an Array
serialize_many_each(key, record, options)
else
serialize_single_relation(key, record, options)
end
......@@ -63,6 +65,14 @@ module Gitlab
end
end
def serialize_many_each(key, records, options)
records.each do |record|
json = Raw.new(record.to_json(options))
json_writer.append(key, json)
end
end
def serialize_single_relation(key, record, options)
json = Raw.new(record.to_json(options))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment