fix destroy categories error

This commit is contained in:
chiu 2020-02-25 11:31:19 +08:00
parent 64d78cff2c
commit 25719f5a8e
1 changed files with 5 additions and 3 deletions

View File

@ -19,21 +19,23 @@ class Admin::PatchfilesController < OrbitAdminController
if i == 0 if i == 0
tags = tags.collect do |tag| tags = tags.collect do |tag|
tag.module_app_ids = [v.id] tag.module_app_ids = [v.id]
tag.save tag.save!
tag tag
end end
cats = cats.collect do |cat| cats = cats.collect do |cat|
cat.module_app_id = v.id cat.module_app_id = v.id
cat.save cat.save!
cat cat
end end
auths = auths.collect do |auth| auths = auths.collect do |auth|
auth.module_app_id = v.id auth.module_app_id = v.id
auth.save auth.save!
auth auth
end end
else else
v.tag_ids = [] v.tag_ids = []
v.categories = nil
v.authorizations = nil
v.destroy v.destroy
end end
end end