Project

General

Profile

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

foreman-docker / app / models / docker_container_wizard_states / preliminary.rb @ 7ff105d1

1
module DockerContainerWizardStates
2
  class Preliminary < ActiveRecord::Base
3
    include Taxonomix
4

    
5
    self.table_name_prefix = 'docker_container_wizard_states_'
6
    belongs_to :wizard_state, :class_name => DockerContainerWizardState,
7
                              :foreign_key => :docker_container_wizard_state_id
8

    
9
    validates :compute_resource_id, :presence => true
10

    
11
    def used_location_ids
12
      Location.joins(:taxable_taxonomies).where(
13
        'taxable_taxonomies.taxable_type' => 'DockerContainerWizardStates::Preliminary',
14
        'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
15
    end
16

    
17
    def used_organization_ids
18
      Organization.joins(:taxable_taxonomies).where(
19
        'taxable_taxonomies.taxable_type' => 'DockerContainerWizardStates::Preliminary',
20
        'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
21
    end
22
  end
23
end