Class: Decidim::Surveys::SurveyForm

Inherits:
Form
  • Object
show all
Defined in:
decidim-surveys/app/forms/decidim/surveys/survey_form.rb

Overview

This class holds a Form to answer a surveys from Decidim’s public page.

Instance Method Summary collapse

Methods inherited from Form

#available_locales

Instance Method Details

#map_model(model) ⇒ Object

Private: Create the answers from the survey questions

Returns nothing.



15
16
17
18
19
# File 'decidim-surveys/app/forms/decidim/surveys/survey_form.rb', line 15

def map_model(model)
  self.answers = model.questions.map do |question|
    SurveyAnswerForm.from_params(question_id: question.id)
  end
end