Revision cc6d0d73
Added by David Davis almost 7 years ago
app/models/service/containers.rb | ||
---|---|---|
24 | 24 |
end |
25 | 25 |
|
26 | 26 |
def create_container_object(wizard_state) |
27 |
container = Container.new(wizard_state.container_attributes) do |r| |
|
27 |
container = Container.new do |r| |
|
28 |
r.attributes = wizard_state.container_attributes |
|
28 | 29 |
# eagerly load environment variables and exposed ports configuration |
29 | 30 |
state = DockerContainerWizardState.includes( |
30 | 31 |
:environment => [:environment_variables, :exposed_ports]).find(wizard_state.id) |
... | ... | |
72 | 73 |
|
73 | 74 |
def load_environment_variables(state, r) |
74 | 75 |
state.environment_variables.each do |environment_variable| |
75 |
r.environment_variables.build :name => environment_variable.name, |
|
76 |
:value => environment_variable.value, |
|
77 |
:priority => environment_variable.priority |
|
76 |
var = r.environment_variables.build |
|
77 |
var.name = environment_variable.name |
|
78 |
var.value = environment_variable.value |
|
79 |
var.priority = environment_variable.priority |
|
78 | 80 |
end |
79 | 81 |
end |
80 | 82 |
|
81 | 83 |
def load_exposed_ports(state, r) |
82 | 84 |
state.exposed_ports.each do |e| |
83 |
r.exposed_ports.build :name => e.name, |
|
84 |
:value => e.value, |
|
85 |
:priority => e.priority |
|
85 |
port = r.exposed_ports.build |
|
86 |
port.name = e.name |
|
87 |
port.value = e.value |
|
88 |
port.priority = e.priority |
|
86 | 89 |
end |
87 | 90 |
end |
88 | 91 |
|
89 | 92 |
def load_dns(state, r) |
90 | 93 |
state.dns.each do |e| |
91 |
r.dns.build :name => e.name, |
|
92 |
:priority => e.priority |
|
94 |
dns = r.dns.build |
|
95 |
dns.name = e.name |
|
96 |
dns.priority = e.priority |
|
93 | 97 |
end |
94 | 98 |
end |
95 | 99 |
|
Also available in: Unified diff
Fixes #15888 - Remove attr_accessible calls