class Question < ActiveRecord::Base belongs_to :survey has_many :answers, :dependent => :destroy accepts_nested_attributes_for :answers, allow_destroy: true validates :text, presence: true, length: { maximum: 25 } enum question_type: [:open, :multiple_choice, :interval_scale, :ordonal_scale ] end