Skip to content

Commit

Permalink
[TAN-2512] dependent destroy idea_import_files & children when projec…
Browse files Browse the repository at this point in the history
…t deleted
  • Loading branch information
jinjagit committed Aug 29, 2024
1 parent f5c06d1 commit 0ee07f8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions back/app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,4 @@ def old_folder_moderators
Project.include(ContentBuilder::Patches::Project)
Project.include(Analysis::Patches::Project)
Project.include(EmailCampaigns::Extensions::Project)
Project.include(BulkImportIdeas::Patches::Project)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IdeaImportFile < ApplicationRecord
belongs_to :project, optional: true

belongs_to :parent, class_name: 'BulkImportIdeas::IdeaImportFile', optional: true
has_many :children, class_name: 'BulkImportIdeas::IdeaImportFile', foreign_key: 'parent_id'
has_many :children, class_name: 'BulkImportIdeas::IdeaImportFile', foreign_key: 'parent_id', dependent: :destroy

validates :name, presence: true
validates :file, presence: true, unless: proc { Current.loading_tenant_template }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module BulkImportIdeas::Patches::Project
def self.included(base)
base.class_eval do
has_many :idea_import_files, class_name: 'BulkImportIdeas::IdeaImportFile', dependent: :destroy
end
end
end
2 changes: 1 addition & 1 deletion env_files/back-safe.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ AWS_TOXICITY_DETECTION_REGION=eu-central-1
# ==== Development experience configuration ====
SEED_SIZE=small
# Tenant is fetched by this host name:
OVERRIDE_HOST=localhost
OVERRIDE_HOST=yourvoice_westoxon_gov_uk
# Set to `true` if you want to upload/download files to/from AWS S3:
USE_AWS_S3_IN_DEV=false
# If USE_AWS_S3_IN_DEV=false, this host is used in file URLs (find it in the code for details):
Expand Down

0 comments on commit 0ee07f8

Please sign in to comment.