Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

chromesetting
daiao 5 years ago
commit 1f5994f62a

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

@ -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
end

Loading…
Cancel
Save