Project

General

Profile

Revision f4c209f1

Added by Dmitri Dolguikh about 8 years ago

fixes #9004: wizard moves correctly between persisted states now

View differences:

app/controllers/containers/steps_controller.rb
5 5

  
6 6
    steps :preliminary, :image, :configuration, :environment
7 7

  
8
    before_filter :build_state
9
    before_filter :set_form
8
    before_filter :find_state
9
    before_filter :build_state, :only => [:update]
10
    before_filter :set_form, :only => [:show]
10 11

  
11 12
    def show
12 13
      @container_resources = allowed_resources if step == :preliminary
......
23 24

  
24 25
    private
25 26

  
26
    def build_state
27
    def find_state
27 28
      @state = DockerContainerWizardState.find(params[:wizard_state_id])
28
      @state.send(:"build_#{step}", params[:"docker_container_wizard_states_#{step}"])
29 29
    rescue ActiveRecord::RecordNotFound
30 30
      not_found
31 31
    end
32 32

  
33
    def build_state
34
      @state.send(:"build_#{step}", params[:"docker_container_wizard_states_#{step}"])
35
    end
36

  
33 37
    def set_form
34
      instance_variable_set("@#{step}", @state.send(:"#{step}") || @state.send(:"build_#{step}"))
38
      instance_variable_set(
39
          "@docker_container_wizard_states_#{step}",
40
          @state.send(:"#{step}") || @state.send(:"build_#{step}"))
35 41
    end
36 42

  
37 43
    def create_container

Also available in: Unified diff