survey/app/models/survey_answer_group.rb

10 lines
301 B
Ruby

class SurveyAnswerGroup
include Mongoid::Document
field :user, type: BSON::ObjectId
field :survey_answer_ids, type: Array, default: []
field :last_modified, type: Time, default: Time.now
belongs_to :questionnaire_survey
def survey_answers
SurveyAnswer.where(:id.in=>survey_answer_ids)
end
end