Class: Helena::Questions::RadioMatrix

Inherits:
Helena::Question show all
Includes:
Concerns::Questions::Requirable, Concerns::Questions::ValidatesOneLabel
Defined in:
app/models/helena/questions/radio_matrix.rb

Direct Known Subclasses

BipolarRadioMatrix

Constant Summary

Constants inherited from Helena::Question

Helena::Question::TYPES

Instance Method Summary collapse

Instance Method Details

#includes_labels?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/models/helena/questions/radio_matrix.rb', line 7

def includes_labels?
  true
end

#includes_subquestions?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/models/helena/questions/radio_matrix.rb', line 11

def includes_subquestions?
  true
end

#validate_answers_in(answers) ⇒ Object



15
16
17
18
19
20
21
# File 'app/models/helena/questions/radio_matrix.rb', line 15

def validate_answers_in(answers)
  errors = {}
  sub_questions.each do |sub_question|
    errors[sub_question.code] = :blank if answers[sub_question.code].blank? && required
  end
  errors
end