cirandas.net

ref: master

plugins/teams/serializers/teams_plugin/member_serializer.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class TeamsPlugin::MemberSerializer < ApplicationSerializer

  attributes :id, :name, :image_url

  def name
    self.profile.name
  end

  def image_url
    return "/images/icons-app/person-#{:minor}.png" unless self.profile.image
    self.profile.image.public_filename :minor
  end

  protected

  def profile
    @profile ||= if self.object.is_a? Profile then self.object else self.object.profile end
  end

end