project.rb 496 Bytes
Newer Older
1 2
# frozen_string_literal: true

Shinya Maeda's avatar
Shinya Maeda committed
3 4 5 6
module Clusters
  class Project < ActiveRecord::Base
    self.table_name = 'cluster_projects'

7 8
    belongs_to :cluster, class_name: 'Clusters::Cluster'
    belongs_to :project, class_name: '::Project'
9 10 11

    has_many :kubernetes_namespaces, class_name: 'Clusters::KubernetesNamespace', foreign_key: :cluster_project_id
    has_one :kubernetes_namespace, -> { order(id: :desc) }, class_name: 'Clusters::KubernetesNamespace', foreign_key: :cluster_project_id
Shinya Maeda's avatar
Shinya Maeda committed
12 13
  end
end