开发者

Creating a wizard-style form spanning multiple models

As the title suggests, I'm looking for a solution to implement a wizard-style form, which would span multiple models. Of course I did find a few resources but all of them focussed on a single model. I found

  1. The acts_as_wizard plugin
  2. Ryan's Railscast on multi-step forms

One more catch in my situation is, the wizard-style of creating stuff is not the only way, which is what I think the plugin and the railscast ass开发者_Go百科ume. That is, I could use the wizard style of creating objects in a sequence or create individual objects in an adhoc fashion.

So, I would preferably restrict code to models or modules and not mess with controller code. Thanks in advance!


i'm working in the same pattern this week.

I have a multi model wizard, where every step touch a set of models. I did work using "transactions", the old ActiveModel transations, that now is a gem.

So basically, my form load always the same view, where i just reload it. this view reload a partial for a specific step. In my wizard all (4) steps are mandatory. so the user is just able to go further if he complete the previous steps. I submit, save the objects that i have to and then move to the next step. If you plan to put one step as review in the end, where you first review what you did and then you apply it. i would recommend to do one single form where you hide and unhide the steps. You can do it easily with javascript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜