Open
Description
I tried this out on a very simple controller like so:
class AdminController < AuthenticatedController
include Wicked::Wizard
steps :step_1, :step_2, :step_3
def show
render_wizard
end
end
I've found a couple of what seem like bugs that prevented this from working and redirected straight away to /
.
First on this line: https://github.com/zombocom/wicked/blob/main/lib/wicked/wizard.rb#L81
This guard clause is pointless:
return if params[:id].nil?
Because you default to the first step already:
the_step ||= steps.first
And the latter code prevents @step
from being set causing it to think the Wizard is complete and redirect to /
.
Secondly on this line: https://github.com/zombocom/wicked/blob/main/lib/wicked/wizard.rb#L64
You're comparing steps that have been converted to a string to one that is not:
resolved_step = valid_steps.detect { |stp| stp.to_s == the_step }
It should be:
resolved_step = valid_steps.detect { |stp| stp.to_s == the_step.to_s }
Metadata
Assignees
Labels
No labels
Activity