jeffp / wizardly

create a functioning wizard for any model in three steps
http://github.com/jeffp/wizardly-examples
MIT License
131 stars 16 forks source link

Wizard support for multiple models #10

Open aquam8 opened 14 years ago

aquam8 commented 14 years ago

Hi Jeff,

It's a great piece of work, well done. I am trying to understand if i can use it for my needs which include creating a bunch of objects (different models) in a wizard (e.g. creating an equipment, one or more machines, hardwares). I currently have this working using nested forms in a single big form basically (and a lot of ajax), but i would like to simplify the process using a wizard like yours.

Is this supported (don't think so)? Any idea on how to do it?

Thanks / Matt

midwire commented 14 years ago

I am also interested in using multiple models. Please keep me informed if there is a way to accomplish that.

michaelgpearce commented 14 years ago

Try using a tableless wizard model with columns defined that will delegate to the real model objects. Then add a validation that checks the delegated models for errors and copies them to the wizard model. Also override the create_or_update to instead do the create/update to delegate to your actual model objects. This pattern worked for me.