demarches-normaliennes/app/serializers/dossier_table_export_serializer.rb

45 lines
800 B
Ruby
Raw Normal View History

class DossierTableExportSerializer < ActiveModel::Serializer
attributes :id,
2017-06-12 13:49:51 +02:00
:created_at,
:updated_at,
:archived,
2017-08-01 14:18:20 +02:00
:email,
2017-06-12 13:49:51 +02:00
:mandataire_social,
:state,
:initiated_at,
:received_at,
:processed_at,
:motivation
2017-04-14 18:10:39 +02:00
attribute :emails_accompagnateurs
attributes :individual_gender,
2017-06-12 13:49:51 +02:00
:individual_prenom,
:individual_nom,
:individual_birthdate
2017-08-01 14:18:20 +02:00
def email
object.user.try(:email)
end
def individual_prenom
object.individual.try(:prenom)
end
def individual_nom
object.individual.try(:nom)
end
def individual_birthdate
object.individual.try(:birthdate)
end
def individual_gender
object.individual.try(:gender)
end
2017-04-14 18:10:39 +02:00
def emails_accompagnateurs
object.followers_gestionnaires.pluck(:email).join(' ')
end
end