mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-12 12:16:06 +08:00
15 lines
439 B
Ruby
15 lines
439 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class RepositoryChecklistItemsValue < ApplicationRecord
|
||
|
belongs_to :repository_checklist_item
|
||
|
belongs_to :repository_checklist_value
|
||
|
|
||
|
validates :repository_checklist_item, :repository_checklist_value, presence: true
|
||
|
|
||
|
after_destroy :destroy_empty_value
|
||
|
|
||
|
def destroy_empty_value
|
||
|
repository_checklist_value.destroy! if repository_checklist_value.repository_checklist_items_values.blank?
|
||
|
end
|
||
|
end
|