|
|
|
@ -11,6 +11,17 @@ class HomeworkCommon < ActiveRecord::Base
|
|
|
|
|
has_many :homework_tests, :dependent => :destroy
|
|
|
|
|
has_many :student_works, :dependent => :destroy
|
|
|
|
|
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
|
|
|
|
|
|
|
|
|
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
|
|
|
|
|
acts_as_attachable
|
|
|
|
|
|
|
|
|
|
after_create :act_as_activity
|
|
|
|
|
after_destroy :delete_kindeditor_assets
|
|
|
|
|
|
|
|
|
|
def act_as_activity
|
|
|
|
|
self.acts << Activity.new(:user_id => self.user_id)
|
|
|
|
|
end
|
|
|
|
|
#删除对应的图片
|
|
|
|
|
def delete_kindeditor_assets
|
|
|
|
|
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|