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

project_namespace.rb « namespaces « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a2ea11ddc5ec61c6a994ca0bf31ac163d791de2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Namespaces
  class ProjectNamespace < Namespace
    # These aliases are added to make it easier to sync parent/parent_id attribute with
    # project.namespace/project.namespace_id attribute.
    #
    # TODO: we can remove these attribute aliases when we no longer need to sync these with project model,
    # see project#sync_attributes
    alias_attribute :namespace, :parent
    alias_attribute :namespace_id, :parent_id
    has_one :project, foreign_key: :project_namespace_id, inverse_of: :project_namespace

    def self.sti_name
      'Project'
    end

    def self.polymorphic_name
      'Namespaces::ProjectNamespace'
    end
  end
end