scinote-web/app/serializers/api/v1/user_serializer.rb
2018-08-21 13:56:14 +02:00

13 lines
468 B
Ruby

module Api
module V1
class UserSerializer < ActiveModel::Serializer
attributes :full_name, :initials, :email
attribute :avatar_file_name,
if: -> { object.avatar.present? } { object.avatar_file_name }
attribute :avatar_file_size,
if: -> { object.avatar.present? } { object.avatar.size }
attribute :avatar_url,
if: -> { object.avatar.present? } { object.avatar.url(:icon) }
end
end
end