Skip to content

previous_step defaults to first step, if current_step == first_step #298

Open
@rjaus

Description

  def previous_step(current_step = nil)
    return @previous_step if current_step.nil?
    index =  steps.index(current_step)
    step  =  steps.at(index - 1) if index.present? && index != 0
    step ||= steps.first
  end

When on the first step of the wizard, I would have expected the previous_step to be nil. But it seems to default to the first step.

Is there a reason for that?

I realise I can monkey patch in a change here. But I was just trying to understand the design decision.

The same occurs for the previous/next_wizard_path view helpers.

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