mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 05:05:55 +08:00
13 lines
468 B
Ruby
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
|