Class: UserSerializer

Inherits:
BaseSerializer show all
Defined in:
app/serializers/user_serializer.rb

Instance Attribute Summary

Attributes inherited from BaseSerializer

#params

Instance Method Summary collapse

Methods inherited from BaseSerializer

entity, #initialize

Constructor Details

This class inherits a constructor from BaseSerializer

Instance Method Details

#represent(resource, opts = {}, entity = nil) ⇒ Object


6
7
8
9
10
11
12
13
14
15
# File 'app/serializers/user_serializer.rb', line 6

def represent(resource, opts = {}, entity = nil)
  if params[:merge_request_iid]
    merge_request = opts[:project].merge_requests.find_by_iid!(params[:merge_request_iid])
    preload_max_member_access(merge_request.project, Array(resource))

    super(resource, opts.merge(merge_request: merge_request), MergeRequestAssigneeEntity)
  else
    super
  end
end