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

30 lines
525 B
Ruby
Raw Normal View History

2018-10-18 23:44:41 -04:00
# frozen_string_literal: true
class PoolRepository < ActiveRecord::Base
belongs_to :shard
validates :shard, presence: true
has_many :member_projects, class_name: 'Project'
2018-10-18 23:44:41 -04:00
after_create :correct_disk_path
2018-10-18 23:44:41 -04:00
def shard_name
shard&.name
end
def shard_name=(name)
self.shard = Shard.by_name(name)
end
private
def correct_disk_path
update(disk_path: storage.disk_path)
end
def storage
Storage::HashedProject
.new(self, prefix: Storage::HashedProject::POOL_PATH_PREFIX)
end
2018-10-18 23:44:41 -04:00
end