diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-07 20:04:21 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-07 20:04:21 +0000 |
commit | f9c6ff7508198e5664ca515b8ec8c1cffa3e8802 (patch) | |
tree | 0711fc32a4bb2874bc0b9a623d2ef0939d8c64c1 /app | |
parent | 942bd5b4112d90c66d637ef350b881574de45065 (diff) | |
parent | da5262f4e6d9524b2af2ad8f6c8ebe10edf17169 (diff) | |
download | gitlab-ce-f9c6ff7508198e5664ca515b8ec8c1cffa3e8802.tar.gz |
Merge branch 'backport-ee-2251' into 'master'
Backport changes in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551 to CE
Closes #21391
See merge request !13275
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 5 | ||||
-rw-r--r-- | app/models/project_import_data.rb | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 0a726e3ffd3..e7baba2ef08 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -164,7 +164,7 @@ class Project < ActiveRecord::Base has_many :todos has_many :notification_settings, as: :source, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent - has_one :import_data, class_name: 'ProjectImportData' + has_one :import_data, class_name: 'ProjectImportData', inverse_of: :project, autosave: true has_one :project_feature has_one :statistics, class_name: 'ProjectStatistics' @@ -193,6 +193,7 @@ class Project < ActiveRecord::Base accepts_nested_attributes_for :variables, allow_destroy: true accepts_nested_attributes_for :project_feature + accepts_nested_attributes_for :import_data delegate :name, to: :owner, allow_nil: true, prefix: true delegate :count, to: :forks, prefix: true @@ -589,8 +590,6 @@ class Project < ActiveRecord::Base project_import_data.credentials ||= {} project_import_data.credentials = project_import_data.credentials.merge(credentials) end - - project_import_data.save end def import? diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb index 37730474324..6da6632f4f2 100644 --- a/app/models/project_import_data.rb +++ b/app/models/project_import_data.rb @@ -1,7 +1,7 @@ require 'carrierwave/orm/activerecord' class ProjectImportData < ActiveRecord::Base - belongs_to :project + belongs_to :project, inverse_of: :import_data attr_encrypted :credentials, key: Gitlab::Application.secrets.db_key_base, marshal: true, |