Skip to content

Commit

Permalink
remove custom properties if manifestation or item is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Apr 29, 2022
1 parent 18f5d13 commit 5fd1549
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Item < ApplicationRecord
belongs_to :budget_type, optional: true
has_one :accept, dependent: :destroy
has_one :withdraw, dependent: :destroy
has_many :item_custom_values, -> { joins(:item_custom_property).order(:position) }
has_many :item_custom_values, -> { joins(:item_custom_property).order(:position) }, dependent: :destroy

belongs_to :shelf, counter_cache: true
accepts_nested_attributes_for :item_custom_values, reject_if: :all_blank
Expand Down
2 changes: 1 addition & 1 deletion app/models/manifestation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Manifestation < ApplicationRecord
belongs_to :required_role, class_name: 'Role', foreign_key: 'required_role_id'
has_one :resource_import_result
has_many :identifiers, dependent: :destroy
has_many :manifestation_custom_values, -> { joins(:manifestation_custom_property).order(:position) }
has_many :manifestation_custom_values, -> { joins(:manifestation_custom_property).order(:position) }, dependent: :destroy
accepts_nested_attributes_for :creators, allow_destroy: true, reject_if: :all_blank
accepts_nested_attributes_for :contributors, allow_destroy: true, reject_if: :all_blank
accepts_nested_attributes_for :publishers, allow_destroy: true, reject_if: :all_blank
Expand Down

0 comments on commit 5fd1549

Please sign in to comment.