Class: Decidim::Surveys::SurveyForm

Inherits:
Form
  • Object
show all
Defined in:
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

Instance Method Details

#map_model(model) ⇒ Object

Private: Create the answers from the survey questions

Returns nothing.



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

def map_model(model)
  self.survey_answers = model.questions.map do |question|
    SurveyAnswerForm.from_model(SurveyAnswer.new(question: question))
  end
end