I\'m trying to understand the best options for pulling off a wizard form in ruby on rails. Ideally I\'d like to have it so the application signup has a back and next button
There are a couple of plugins that provide wizzard construction facilitation in rails.
Acts as Wizard and Wizardly seem the most popular.
The main idea is to:
* create a model in the first step
* then edit it on subsequent steps,
* applying partial validation on each step and
* having the model implement some sort of state machine.
Wicked looks promising for rails 3:
https://github.com/schneems/wicked
Have a look at wicked, explained in this rails cast: http://railscasts.com/episodes/346-wizard-forms-with-wicked?autoplay=true
An alternative approach, for simpler multi step forms especially, is to simply show-hide parts of a single form depending on the step, this way you don't hit the database on every step but rather let the user build up his object until he's ready with a valid instance.
Such an approach strongly favors using a form class instead of working with the model directly (http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/) and you need to tweak error message rendering a bit.
Pros: only one db hit, no hassle with persisting invalid instances (not null columns, before_save sanity checks for messed up attributes), no callback hell
Cons: more html sent to user, error message tweaks, requires a well built form class to be elegant and really useful
You should watch this rails cast episode on multi step forms:
http://railscasts.com/episodes/217-multistep-forms
Be prepared to rewind and watch again. He's very quick!