class Grade < ApplicationRecord

  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
