Project

General

Profile

Revision 2b80fdd9

Added by Ori Rabin almost 6 years ago

Fixes #13043 - Change Parameter inheritance to DockerParameter

View differences:

app/models/docker_container_wizard_states/environment.rb
3 3
    self.table_name_prefix = 'docker_container_wizard_states_'
4 4
    belongs_to :wizard_state, :class_name => DockerContainerWizardState
5 5

  
6
    # Fix me:
7
    # Validations are off on this association as there's a bug in ::Parameter
8
    # that forces validation of reference_id. This will fail on new records as
9
    # validations are executed before parent and children records have been persisted.
10 6
    has_many :environment_variables, :dependent  => :destroy, :foreign_key => :reference_id,
11 7
                                     :inverse_of => :environment,
12 8
                                     :class_name =>
13
                                       'DockerContainerWizardStates::EnvironmentVariable',
14
                                     :validate => false
15
    include ::ParameterValidators
9
                                       'DockerContainerWizardStates::EnvironmentVariable'
16 10

  
17 11
    has_many :exposed_ports,  :dependent  => :destroy, :foreign_key => :reference_id,
18 12
                              :inverse_of => :environment,
19
                              :class_name => 'DockerContainerWizardStates::ExposedPort',
20
                              :validate => true
13
                              :class_name => 'DockerContainerWizardStates::ExposedPort'
21 14
    has_many :dns,  :dependent  => :destroy, :foreign_key => :reference_id,
22 15
                    :inverse_of => :environment,
23
                    :class_name => 'DockerContainerWizardStates::Dns',
24
                    :validate => true
16
                    :class_name => 'DockerContainerWizardStates::Dns'
25 17

  
18
    include ForemanDocker::ParameterValidators
26 19
    accepts_nested_attributes_for :environment_variables, :allow_destroy => true
27 20
    accepts_nested_attributes_for :exposed_ports, :allow_destroy => true
28 21
    accepts_nested_attributes_for :dns, :allow_destroy => true
29 22

  
30
    def parameters_symbol
31
      :environment_variables
32
    end
33 23
  end
34 24
end

Also available in: Unified diff