Class: Helena::Questions::CheckboxGroup

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

Constant Summary

Constants inherited from Helena::Question

Helena::Question::TYPES

Instance Method Summary collapse

Methods inherited from Helena::Question

#includes_labels?

Instance Method Details

#includes_subquestions?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'app/models/helena/questions/checkbox_group.rb', line 6

def includes_subquestions?
  true
end

#validate_answers_in(answers) ⇒ Object



10
11
12
13
14
# File 'app/models/helena/questions/checkbox_group.rb', line 10

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