删除作品时,删除作品的点赞数
This commit is contained in:
parent
666539a4cc
commit
1f6ed64e54
|
@ -9,5 +9,11 @@ class StudentWork < ActiveRecord::Base
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
has_one :student_work_test
|
has_one :student_work_test
|
||||||
|
|
||||||
|
before_destroy :delete_praise
|
||||||
|
|
||||||
acts_as_attachable
|
acts_as_attachable
|
||||||
|
|
||||||
|
def delete_praise
|
||||||
|
PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue