2019-05-02 16:24:24 +02:00
|
|
|
class AvisSerializer < ActiveModel::Serializer
|
2021-02-25 10:10:24 +01:00
|
|
|
attributes :answer,
|
2019-05-02 16:24:24 +02:00
|
|
|
:introduction,
|
|
|
|
:created_at,
|
|
|
|
:answered_at
|
|
|
|
|
|
|
|
def email
|
2021-02-25 10:10:24 +01:00
|
|
|
object.expert.email
|
2019-05-02 16:24:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def created_at
|
|
|
|
object.created_at&.in_time_zone('UTC')
|
|
|
|
end
|
|
|
|
|
|
|
|
def answered_at
|
|
|
|
object.updated_at&.in_time_zone('UTC')
|
|
|
|
end
|
|
|
|
end
|