Class: Helena::SubQuestion
- Inherits:
-
Object
- Object
- Helena::SubQuestion
- Includes:
- Concerns::ApplicationModel, Mongoid::Orderable
- Defined in:
- app/models/helena/sub_question.rb
Instance Method Summary collapse
Instance Method Details
#parts ⇒ Object
22 23 24 |
# File 'app/models/helena/sub_question.rb', line 22 def parts text.split '|' end |
#splitted? ⇒ Boolean
18 19 20 |
# File 'app/models/helena/sub_question.rb', line 18 def splitted? parts.size > 1 end |
#uniqueness_of_code ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/models/helena/sub_question.rb', line 26 def uniqueness_of_code return unless question question_code_occurences = question.question_group.version.question_code_occurences return true if question_code_occurences[code] <= 1 errors.add(:code, :taken, value: code) end |