|
|
@ -38,6 +38,7 @@ class Shixun < ApplicationRecord
|
|
|
|
belongs_to :user
|
|
|
|
belongs_to :user
|
|
|
|
# 实训服务配置
|
|
|
|
# 实训服务配置
|
|
|
|
has_many :shixun_service_configs, :dependent => :destroy
|
|
|
|
has_many :shixun_service_configs, :dependent => :destroy
|
|
|
|
|
|
|
|
has_many :tidings, as: :container, dependent: :destroy
|
|
|
|
|
|
|
|
|
|
|
|
scope :search_by_name, ->(keyword) { where("name like ? or description like ? ",
|
|
|
|
scope :search_by_name, ->(keyword) { where("name like ? or description like ? ",
|
|
|
|
"%#{keyword}%", "%#{keyword}%") }
|
|
|
|
"%#{keyword}%", "%#{keyword}%") }
|
|
|
@ -248,7 +249,7 @@ class Shixun < ApplicationRecord
|
|
|
|
private
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
def send_tiding
|
|
|
|
def send_tiding
|
|
|
|
self.tidings << Tiding.new(:user_id => self.user_id, :trigger_user_id => self.user_id, :belong_container_id => self.id, :belong_container_type =>'Shixun', :tiding_type => "System", :viewed => 0)
|
|
|
|
self.tidings << Tiding.new(:user_id => user_id, :trigger_user_id => 1, :belong_container_id => id, :belong_container_type =>'Shixun', :tiding_type => "System", :viewed => 0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|