2021-09-12 12:20:03 +00:00
|
|
|
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
|
2021-10-13 09:15:47 +00:00
|
|
|
after_destroy do
|
|
|
|
SurveyAnswer.where(:id.in=>survey_answer_ids).destroy
|
|
|
|
end
|
2021-09-12 12:20:03 +00:00
|
|
|
end
|