diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-25 03:06:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-25 03:06:02 +0000 |
commit | 543081566d10160511ef09e929195ef3f48f5fa3 (patch) | |
tree | 7c9078aa42eb450ca20bed02b74e8e15e4d2e5e5 /lib | |
parent | 6d43720a1a86ccca9618417a6d0415e7d522fa49 (diff) | |
download | gitlab-ce-543081566d10160511ef09e929195ef3f48f5fa3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/relation_factory.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index cb85af91f75..ae8025c52ef 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -292,9 +292,11 @@ module Gitlab existing_object else - object = relation_class.new - - # Use #assign_attributes here to call object custom setters + # Because of single-type inheritance, we need to be careful to use the `type` field + # See https://gitlab.com/gitlab-org/gitlab/issues/34860#note_235321497 + inheritance_column = relation_class.try(:inheritance_column) + inheritance_attributes = parsed_relation_hash.slice(inheritance_column) + object = relation_class.new(inheritance_attributes) object.assign_attributes(parsed_relation_hash) object end |