I’m a bit stumped on how to write a ‘registration wizard’. When a user
registers a home address with our app, the app needs to fetch and
assemble lots of bits of data from other sites on the interweb
(geocoding, looking up tax records, finding local weather stations). I
want to make this process as simple as possible for the user.
There are a few challenges:
some operations take a long time, and I really need to give the user
feedback about what’s happening.
when some information can’t be found from an external site, I need to
present a form to the user and ask them to fill in the missing
order is important. some bits of data (e.g. local weather stations)
cannot be fetched until other bits of data (e.g. geocoded address) have
been set up.
state is not limited to external data. for example, some operations
can be performed without the user logging in, others require the user to
be logged in (and/or registered)
if this is to be implemented as state machine, where do you store the
state, and what state do you store? Is it a db-backed AR model,
in a session variable, or in query strings?
So we have a complicated set of dependencies and the ‘state’ is
scattered throughout various models. I haven’t yet wrapped my head
around how best to bundle this up into an easy-to-maintain ‘registration
What do y’all suggest?
[P.S.: I started out by ad-hoc coding in the WizardsController, using
query strings to store the state and using meta-refresh tags with the
flash to give the user feedback as the system progressed from one
state to the next. But that got out of hand pretty quickly. There must
be a cleaner way.]