|
|
@ -17,13 +17,15 @@ class Admins::LaboratorySubjectsController < Admins::BaseController
|
|
|
|
def destroy
|
|
|
|
def destroy
|
|
|
|
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
|
|
|
|
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
|
|
|
|
|
|
|
|
|
|
|
|
current_subject = current_laboratory_subject.subject
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
current_subject.shixuns.each do |shixun|
|
|
|
|
current_subject = current_laboratory_subject.subject
|
|
|
|
shixun.destroy!
|
|
|
|
current_subject.shixuns.each do |shixun|
|
|
|
|
|
|
|
|
shixun.destroy!
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
current_subject.destroy!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render_delete_success
|
|
|
|
end
|
|
|
|
end
|
|
|
|
current_subject.destroy!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render_delete_success
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|