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: c74f75b2d8efc924d41fe3249b80b256bd087666 (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_ancestors) }
end