I'm still learning rails and would like to know the best way to proceed.
I have a wizard interface where I'd like to allow the user to create an
Event, along with several children models, some of which are children
via has-many through relationships.
I've started by creating partials under Event (step1,step2,step3) etc.
each with their own form. I've using all remote=>true ajax calls and
hiding/showing the different step partials after each submission. I'm
leveraging accepts nested attributes to do everything through the Event.
Is this the best approach?
Should I instead have a initial form to create the base Event model
(step 1). Then take them to a different controller to create one of the
child objects? If so should it be a view on the junction object? (ex.
event location is a junction between event and locations)
Hopefully this made sense, I'm just looking for some direction and
advice.
One thing I forgot to mention is at one stage of the form they'll need
to create children for records that were built in an earlier step.
Example (you create several children for the event in step 2 and in step
3 you create children for those)
in general, create an attribute (call it :stage) - base your view names and validation rules upon :stage
:stage can be virtual, or if you store it you could allow someone to return to entry later
for a more advanced implementation you could use a state machine (instead of stage) - which may give you more power if you want to process the data entered asynchronously