summaryrefslogtreecommitdiff
path: root/app/models/bulk_imports/entity.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-27 18:12:38 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-27 18:12:38 +0000
commit223359576dabfa1539f2f44fc817e9760ad831c9 (patch)
treec8bfa8b5bd8ab354eea78e094060c91f3e1ff908 /app/models/bulk_imports/entity.rb
parent28b15b6b1c591fd7796bf3a7a20508d991216b51 (diff)
downloadgitlab-ce-223359576dabfa1539f2f44fc817e9760ad831c9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/bulk_imports/entity.rb')
-rw-r--r--app/models/bulk_imports/entity.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/bulk_imports/entity.rb b/app/models/bulk_imports/entity.rb
index ab5d248ff8c..d2b9e1f567a 100644
--- a/app/models/bulk_imports/entity.rb
+++ b/app/models/bulk_imports/entity.rb
@@ -20,6 +20,8 @@
class BulkImports::Entity < ApplicationRecord
self.table_name = 'bulk_import_entities'
+ EXPORT_RELATIONS_URL = '/%{resource}/%{full_path}/export_relations'
+
belongs_to :bulk_import, optional: false
belongs_to :parent, class_name: 'BulkImports::Entity', optional: true
@@ -102,6 +104,14 @@ class BulkImports::Entity < ApplicationRecord
end
end
+ def pluralized_name
+ source_type.gsub('_entity', '').pluralize
+ end
+
+ def export_relations_url_path
+ @export_relations_url_path ||= EXPORT_RELATIONS_URL % { resource: pluralized_name, full_path: encoded_source_full_path }
+ end
+
private
def validate_parent_is_a_group