2018-10-18 23:44:41 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PoolRepository < ActiveRecord::Base
|
2018-11-29 11:08:14 -05:00
|
|
|
include Shardable
|
2018-10-18 23:44:41 -04:00
|
|
|
|
2018-11-20 06:48:18 -05:00
|
|
|
has_many :member_projects, class_name: 'Project'
|
2018-10-18 23:44:41 -04:00
|
|
|
|
2018-11-20 06:48:18 -05:00
|
|
|
after_create :correct_disk_path
|
2018-10-18 23:44:41 -04:00
|
|
|
|
2018-11-20 06:48:18 -05:00
|
|
|
private
|
|
|
|
|
|
|
|
def correct_disk_path
|
2018-11-28 03:29:46 -05:00
|
|
|
update!(disk_path: storage.disk_path)
|
2018-11-20 06:48:18 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def storage
|
|
|
|
Storage::HashedProject
|
|
|
|
.new(self, prefix: Storage::HashedProject::POOL_PATH_PREFIX)
|
|
|
|
end
|
2018-10-18 23:44:41 -04:00
|
|
|
end
|