Project

General

Profile

Download (742 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / models / docker_registry.rb @ ada932ab

1
class DockerRegistry < ActiveRecord::Base
2
  include Authorizable
3
  include Taxonomix
4

    
5
  has_many :docker_image_docker_registries
6
  has_many :images, :class_name => 'DockerImage',
7
           :through => :docker_image_docker_registries, :uniq => true
8

    
9
  scoped_search :on => :name, :complete_value => true
10
  scoped_search :on => :url
11

    
12
  def used_location_ids
13
    Location.joins(:taxable_taxonomies).where(
14
        'taxable_taxonomies.taxable_type' => 'DockerRegistry',
15
        'taxable_taxonomies.taxable_id' => id).pluck(:id)
16
  end
17

    
18
  def used_organization_ids
19
    Organization.joins(:taxable_taxonomies).where(
20
        'taxable_taxonomies.taxable_type' => 'DockerRegistry',
21
        'taxable_taxonomies.taxable_id' => id).pluck(:id)
22
  end
23
end