app/models/helena/question_group.rb in helena-0.3.3 vs app/models/helena/question_group.rb in helena-1.0.0.rc1
- old
+ new
@@ -1,16 +1,17 @@
module Helena
class QuestionGroup
include Helena::Concerns::ApplicationModel
include Mongoid::Orderable
- embedded_in :version
+ belongs_to :version
- embeds_many :questions, class_name: 'Helena::Question'
+ has_many :questions, inverse_of: :question_group, class_name: 'Helena::Question', dependent: :destroy
- orderable
+ 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