编程题的删除

mast_item_banktwo
cxt 5 years ago
parent 496393db19
commit f28300177b

@ -43,8 +43,9 @@ class ItemBanksController < ApplicationController
ApplyAction.where(container_type: "ItemBank", container_id: @item.id).destroy_all ApplyAction.where(container_type: "ItemBank", container_id: @item.id).destroy_all
if @item.item_type == "PROGRAM" if @item.item_type == "PROGRAM"
@item.container&.destroy! @item.container&.destroy!
end else
@item.destroy! @item.destroy!
end
render_ok render_ok
end end
end end

@ -23,7 +23,6 @@ class Hack < ApplicationRecord
belongs_to :sub_discipline belongs_to :sub_discipline
has_one :item_bank, as: :container, dependent: :destroy has_one :item_bank, as: :container, dependent: :destroy
has_one :examination_bank, as: :container, dependent: :destroy
scope :published, -> { where(status: 1) } scope :published, -> { where(status: 1) }
scope :unpublish, -> { where(status: 0) } scope :unpublish, -> { where(status: 0) }

Loading…
Cancel
Save