Welcome to mirror list, hosted at ThFree Co, Russian Federation.

jira_connect_subscription.rb « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8ff89560f09ac99d0235919eb39e2bfc63ef1233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

class JiraConnectSubscription < ApplicationRecord
  belongs_to :installation, class_name: 'JiraConnectInstallation', foreign_key: 'jira_connect_installation_id'
  belongs_to :namespace

  validates :installation, presence: true
  validates :namespace, presence: true, uniqueness: { scope: :jira_connect_installation_id, message: 'has already been added' }

  scope :preload_namespace_route, -> { preload(namespace: :route) }
  scope :for_project, -> (project) { where(namespace_id: project.namespace.self_and_ancestor_ids) }
end