#encoding: utf-8 class Training < ActiveRecord::Base attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type, :major, :student_id # training_type 1 2018-培训会 2 警察学院大数据培训会 has_one :training_payinfo Training_Type = 2 #警察学院大数据培训会 ## 是否填过支付信息 def pay? !training_payinfo.nil? && !training_payinfo.status.nil? end ## 是否已真正支付 # 1. 微信支付 # 2. 银行卡支付,后台已确认 def payed? pay? && training_payinfo.payed? end end