Sha256: 4d5baa29022a50ba64673395f96943f0a8b458c1f26ec3964e66c0a1c28a34eb

Contents?: true

Size: 507 Bytes

Versions: 6

Compression:

Stored size: 507 Bytes

Contents

module Helena
  class QuestionGroup
    include Helena::Concerns::ApplicationModel
    include Mongoid::Orderable

    belongs_to :version

    has_many :questions, inverse_of: :question_group, class_name: 'Helena::Question', dependent: :destroy,  autosave: true

    orderable scope: :version

    field :title, type: String
    field :allow_to_go_back, type: Boolean

    def question_codes
      questions.map { |question| [question.code] + question.sub_questions.map(&:code) }.flatten
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
helena-1.1.0 app/models/helena/question_group.rb
helena-1.0.3 app/models/helena/question_group.rb
helena-1.0.2 app/models/helena/question_group.rb
helena-1.0.1 app/models/helena/question_group.rb
helena-1.0.0.rc4 app/models/helena/question_group.rb
helena-1.0.0.rc3 app/models/helena/question_group.rb