# container_type: # Phone-手机注册;Mail-邮箱绑定;Account-完善资料;Answer-查看参考答案;Game-闯关; testSet-查看测试集; #shixunPublish-实训发布 # Avatar-首次上传头像 Attendance-签到 Memo/Discusses-发布帖子或评论 Star-实训评分获得的随机奖励 CheckTaAnswer-查看他人答案 # Feedback-反馈问题 Authentication-实名认证 Professional-职业认证 class Grade < ActiveRecord::Base attr_accessible :container_id, :container_type, :score, :user_id belongs_to :user has_many :tidings, :as => :container, :dependent => :destroy after_create :send_tiding def send_tiding self.tidings << Tiding.new(:user_id => self.user_id, :trigger_user_id => 0, :parent_container_id => self.container_id, :parent_container_type => self.container_type, :viewed => 0, :tiding_type => "System") end end