Class: Decidim::Meetings::DownloadYourDataUserAnswersSerializer

Inherits:
Exporters::Serializer
  • Object
show all
Includes:
TranslationsHelper
Defined in:
lib/decidim/meetings/download_your_data_user_answers_serializer.rb

Instance Method Summary collapse

Instance Method Details

#serializeObject

Serializes an user answer for download your data



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/decidim/meetings/download_your_data_user_answers_serializer.rb', line 8

def serialize
  {
    id: resource.id,
    user: {
      name: resource.user.name,
      email: resource.user.email
    },
    questionnaire: {
      id: resource.question.questionnaire.id
    },
    question: {
      id: resource.question.id,
      body: translated_attribute(resource.question.body)
    },
    answer: normalize_body(resource)
  }
end