diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-31 00:10:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-31 00:10:33 +0000 |
commit | 13ddda5208f9175e822af6d05a32600bc9cad091 (patch) | |
tree | d0dede48f80b34cfbf326d9539edc2e2addf4398 /app/models/deploy_key.rb | |
parent | dd8c199e989482245c58ee49b5f7169bdd9073eb (diff) | |
download | gitlab-ce-13ddda5208f9175e822af6d05a32600bc9cad091.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/deploy_key.rb')
-rw-r--r-- | app/models/deploy_key.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb index aaafa396337..47829a07495 100644 --- a/app/models/deploy_key.rb +++ b/app/models/deploy_key.rb @@ -9,9 +9,9 @@ class DeployKey < Key has_many :deploy_keys_projects, inverse_of: :deploy_key, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :projects, through: :deploy_keys_projects - has_many :deploy_keys_projects_with_write_access, -> { with_write_access }, class_name: "DeployKeysProject" + has_many :deploy_keys_projects_with_write_access, -> { with_write_access }, class_name: "DeployKeysProject", inverse_of: :deploy_key has_many :projects_with_write_access, -> { includes(:route) }, class_name: 'Project', through: :deploy_keys_projects_with_write_access, source: :project - has_many :protected_branch_push_access_levels, class_name: '::ProtectedBranch::PushAccessLevel' + has_many :protected_branch_push_access_levels, class_name: '::ProtectedBranch::PushAccessLevel', inverse_of: :deploy_key scope :in_projects, ->(projects) { joins(:deploy_keys_projects).where(deploy_keys_projects: { project_id: projects }) } scope :with_write_access, -> { joins(:deploy_keys_projects).merge(DeployKeysProject.with_write_access) } |