Skip to content

Method jump_to does not redirect #303

Open
@mjtribble

Description

I use the session to persist data from each step rather than persisting in the DB. This seems to mean I cannot use render_wizard to move from step to step because there is nothing to persist with a save method. Instead, I use jump_to to redirect to the next step after an update.

Example Wizard Controller

class MyWizardController < ApplicationController
  include Wicked::Wizard
  
  steps :uno, :dos, :tres

  def show
    jump_to(steps.first) unless step
    render_wizard
  end

  def update
    send(step)
  end

  private

  def uno
    session[:test] = params[:test]
    jump_to(:dos) # also jump_to next_step
  end

  def dos
    session[:test2] = params[:test2]
    jump_to(:tres)
  end
end

On the first render, a step is not defined. The jump_to function redirects correctly to the first step's URL /wizard?uno. However, specifying a step to "jump_to" in the update actions, in my case, just re-renders the current step /wizard?uno instead of /wizard?dos.
Manually calling redirect_to redirect_to wizard_path(next_step) || redirect_to(:dos) works.

What am I missing here? Thanks for your help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions