class AskQuestion include Mongoid::Document include Mongoid::Timestamps # include ActiveModel::Validations include OrbitCategory::Categorizable include OrbitTag::Taggable # 欄位 field :name, type: String field :identity, type: String field :mail, type: String field :phone, type: String field :fax, type: String field :title, type: String field :content, type: String field :appointment, type:DateTime field :sex field :reply, type: String field :comment, type: String field :situation, type: String, default: "is_waiting" #預設待處理 field :send_email, type: Boolean, default: false field :email_id field :custom_values, type: Hash,default: {} # validates_presence_of :name, :identity, :mail, :title, :content def email mail = Email.find(self.email_id) rescue nil end def email_address email_address = AskAdmin.all.collect{|a| a.email} rescue [] # email_address = email_address +[self.mail] if !self.mail.blank? email_address.flatten end end