Module: Wicked::Controller::Concerns::RenderRedirect

Extended by:
ActiveSupport::Concern
Included in:
Wizard
Defined in:
lib/wicked/controller/concerns/render_redirect.rb

Instance Method Summary collapse

Instance Method Details

#_reset_invocation_responseObject

scary and gross, allows for double render



6
7
8
9
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 6

def _reset_invocation_response
  self.instance_variable_set(:@_response_body, nil)
  response.instance_variable_set :@header, Rack::Utils::HeaderHash.new("cookie" => [], 'Content-Type' => 'text/html')
end

#finish_wizard_pathObject



38
39
40
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 38

def finish_wizard_path
  '/'
end

#redirect_to_finish_wizardObject



42
43
44
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 42

def redirect_to_finish_wizard
  redirect_to finish_wizard_path
end

#redirect_to_next(next_step) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 30

def redirect_to_next(next_step)
  if next_step.nil?
    redirect_to_finish_wizard
  else
    redirect_to wizard_path(next_step)
  end
end

#render_step(the_step) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 22

def render_step(the_step)
  if the_step.nil? || the_step == :finish
    redirect_to_finish_wizard
  else
    render the_step
  end
end

#render_wizard(resource = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 12

def render_wizard(resource = nil)
  _reset_invocation_response
  @skip_to = @next_step if resource && resource.save
  if @skip_to.present?
    redirect_to wizard_path @skip_to
  else
    render_step  @step
  end
end