#encoding: utf-8 class PollQuestion < ActiveRecord::Base # attr_accessible :is_necessary, :polls_id, :question_title, :question_type include Redmine::SafeAttributes belongs_to :poll has_many :poll_answers, :order => "#{PollAnswer.table_name}.answer_position",:dependent => :destroy has_many :poll_votes, :dependent => :destroy def question_type_name case self.question_type when 1 "单选题" when 2 "多选题" when 3 "主观题" when 4 "多行主观题" end end end