survey/app/models/survey_question_option_leve...

20 lines
516 B
Ruby

class SurveyQuestionOptionLevel2
include Mongoid::Document
field :name, :localize => true
field :jump_to, :default => 0
field :points, :type => Integer, :default => 0
embedded_in :level1, class_name: "SurveyQuestionOption"
def serializable_hash(options = nil)
tmp = super(options)
tmp.merge({name_translations: self[:name], qid: self[:_id].to_s})
tmp
end
def as_json(**xargs)
res = super
res.merge({name_translations: self.name_translations, qid: self[:_id].to_s})
end
end