zombocom / wicked

Use wicked to turn your controller into a wizard

Home Page:http://schneems.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redirect on asking for step '1' ?

jnicho02 opened this issue · comments

Using a path helper in a view to link to my project 'write' wizard I tried: <%= link_to 'write', project_write_path(@project) %> which points to /projects/1/write/1 giving an InvalidStepError

passing in the first step name works: <%= link_to 'write', project_write_path(@project, :review_site_details) %> points to /projects/1/write/review_site_details

Question: should /projects/1/write/1 not just automagically repoint itself to the first step in the controller rather than giving an error. Otherwise I believe I have to deliberately name the first step in links.

should /projects/1/write/1 not just automagically repoint itself

No. Is there something in the documentation that made you think it would do so? We should update the docs if that's the case.

Otherwise I believe I have to deliberately name the first step in links.

Correct, or use the "index" action of that controller which auto redirects to the first step. So going to /projects/1/write should send you to /projects/1/write/review_site_details. You can also use the first step constant as documented here https://github.com/schneems/wicked#keywords

Thanks. <%= link_to 'write', project_write_index_path(@project) %> was what I was after.

Nothing in the readme suggested the wrong attempt, but maybe there could be a hint in the Quick Reference?

Nice gem BTW. 👍