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

Steps #39

Closed
karellm opened this issue Oct 24, 2011 · 1 comment
Closed

Steps #39

karellm opened this issue Oct 24, 2011 · 1 comment

Comments

@karellm
Copy link

karellm commented Oct 24, 2011

Hi,

We'd like to use workflow to create a wizard. Is there any way to get the current step and the total number of steps in the workflow?

Thanks

@geekq
Copy link
Owner

geekq commented Oct 24, 2011

You can access your workflow specification as described in
the documentation http://www.geekq.net/workflow/#accessing_your_workflow_specification

Workflow states appear in the array in the order they were defined

Article.workflow_spec.states.keys
#=> [:rejected, :awaiting_review, :being_reviewed, :accepted, :new]

Article.workflow_spec.states.length
#=> 5

Use Array#index to find out the index of the current state in
the complete list of all possible states. Something like

Article.workflow_spec.states.keys.index(article.current_state.name)

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

2 participants