From f28300177bf6f90ba656932e57906ca5ab1d95aa Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 15 Jan 2020 17:36:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E9=A2=98=E7=9A=84=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/item_banks_controller.rb | 3 ++- app/models/hack.rb | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/item_banks_controller.rb b/app/controllers/item_banks_controller.rb index 86b1523c3..f108c1fad 100644 --- a/app/controllers/item_banks_controller.rb +++ b/app/controllers/item_banks_controller.rb @@ -43,8 +43,9 @@ class ItemBanksController < ApplicationController ApplyAction.where(container_type: "ItemBank", container_id: @item.id).destroy_all if @item.item_type == "PROGRAM" @item.container&.destroy! + else + @item.destroy! end - @item.destroy! render_ok end end diff --git a/app/models/hack.rb b/app/models/hack.rb index 0c5970af4..9c8ca44fb 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -23,7 +23,6 @@ class Hack < ApplicationRecord belongs_to :sub_discipline has_one :item_bank, as: :container, dependent: :destroy - has_one :examination_bank, as: :container, dependent: :destroy scope :published, -> { where(status: 1) } scope :unpublish, -> { where(status: 0) }