@ -17,12 +17,16 @@ class Admins::LaboratorySubjectsController < Admins::BaseController
def destroy
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
ActiveRecord::Base.transaction do
current_subject = current_laboratory_subject.subject
current_subject.shixuns.destroy_all
current_subject.shixuns.each do |shixun|
shixun.destroy!
end
current_subject.destroy!
render_delete_success
def homepage
@ -3,5 +3,5 @@ class ShixunTagRepertoire < ApplicationRecord
belongs_to :tag_repertoire
has_many :memos, :through => :memo_tag_repertoires
has_many :memo_tag_repertoires, :dependent => :destroy
# has_many :memo_tag_repertoires, :dependent => :destroy