gitlab-org--gitlab-foss/app/models/jira_connect_subscription.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
557 B
Ruby
Raw Normal View History

# 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