Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method jump_to does not redirect #303

Open
mjtribble opened this issue Mar 11, 2024 · 0 comments
Open

Method jump_to does not redirect #303

mjtribble opened this issue Mar 11, 2024 · 0 comments

Comments

@mjtribble
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant