Class: Decidim::Surveys::SurveyQuestion

Inherits:
ApplicationRecord show all
Defined in:
decidim-surveys/app/models/decidim/surveys/survey_question.rb

Overview

The data store for a SurveyQuestion in the Decidim::Surveys component.

Constant Summary collapse

TYPES =
%w(short_answer long_answer single_option multiple_option).freeze

Instance Method Summary collapse

Instance Method Details

#answer_optionsObject

Rectify can’t handle a hash when using the from_model method so the answer options must be converted to struct.



15
16
17
# File 'decidim-surveys/app/models/decidim/surveys/survey_question.rb', line 15

def answer_options
  self[:answer_options].map { |option| OpenStruct.new(option) }
end