Project

General

Profile

Revision 1f890719

Added by Stephen Benjamin about 5 years ago

refs #23019 - don't pass class to class_name in assocs (#211)

View differences:

app/models/container.rb
3 3
  include Taxonomix
4 4

  
5 5
  belongs_to :compute_resource
6
  belongs_to :registry, :class_name => "DockerRegistry", :foreign_key => :registry_id
6
  belongs_to :registry, :class_name => 'DockerRegistry', :foreign_key => :registry_id
7 7
  has_many :environment_variables, :dependent  => :destroy, :foreign_key => :reference_id,
8 8
                                   :inverse_of => :container,
9 9
                                   :class_name => 'EnvironmentVariable'
app/models/docker_container_wizard_state.rb
1 1
class DockerContainerWizardState < ApplicationRecord
2
  has_one :preliminary, :class_name => DockerContainerWizardStates::Preliminary,
2
  has_one :preliminary, :class_name => 'DockerContainerWizardStates::Preliminary',
3 3
                        :dependent => :destroy, :validate => true, :autosave => true
4
  has_one :image, :class_name => DockerContainerWizardStates::Image,
4
  has_one :image, :class_name => 'DockerContainerWizardStates::Image',
5 5
                  :dependent => :destroy, :validate => true, :autosave => true
6
  has_one :configuration, :class_name => DockerContainerWizardStates::Configuration,
6
  has_one :configuration, :class_name => 'DockerContainerWizardStates::Configuration',
7 7
                          :dependent => :destroy, :validate => true, :autosave => true
8
  has_one :environment, :class_name => DockerContainerWizardStates::Environment,
8
  has_one :environment, :class_name => 'DockerContainerWizardStates::Environment',
9 9
                        :dependent => :destroy, :validate => true, :autosave => true
10 10

  
11 11
  delegate :compute_resource_id,   :to => :preliminary
app/models/docker_container_wizard_states/configuration.rb
1 1
module DockerContainerWizardStates
2 2
  class Configuration < ApplicationRecord
3 3
    self.table_name_prefix = 'docker_container_wizard_states_'
4
    belongs_to :wizard_state, :class_name => DockerContainerWizardState,
4
    belongs_to :wizard_state, :class_name => 'DockerContainerWizardState',
5 5
                              :foreign_key => :docker_container_wizard_state_id
6 6
  end
7 7
end
app/models/docker_container_wizard_states/environment.rb
1 1
module DockerContainerWizardStates
2 2
  class Environment < ApplicationRecord
3 3
    self.table_name_prefix = 'docker_container_wizard_states_'
4
    belongs_to :wizard_state, :class_name => DockerContainerWizardState
4
    belongs_to :wizard_state, :class_name => 'DockerContainerWizardState'
5 5

  
6 6
    has_many :environment_variables, :dependent  => :destroy, :foreign_key => :reference_id,
7 7
                                     :inverse_of => :environment,
app/models/docker_container_wizard_states/image.rb
1 1
module DockerContainerWizardStates
2 2
  class Image < ApplicationRecord
3 3
    self.table_name_prefix = 'docker_container_wizard_states_'
4
    belongs_to :wizard_state, :class_name => DockerContainerWizardState,
4
    belongs_to :wizard_state, :class_name => 'DockerContainerWizardState',
5 5
                              :foreign_key => :docker_container_wizard_state_id
6 6
    delegate :compute_resource_id, :to => :wizard_state
7 7
    delegate :compute_resource, :to => :wizard_state
app/models/docker_container_wizard_states/preliminary.rb
3 3
    include Taxonomix
4 4

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

  
9 9
    belongs_to :compute_resource, :required => true

Also available in: Unified diff