Rails 3 multi-step file upload form

I am having trouble trying to figure out how to implement a multi-page Rails 3 form with file uploads, where each step is handled by the update / edit actions in the controller.

Ryan Bates provided his wonderful screencast for making multi-stage forms using sessions, as well as a brief description of how to achieve something like this, saving databases at the initial stage, and then performing updates at each subsequent step. I also read his gist , giving a more detailed explanation of some of the different options for creating a multi-stage form (I am inclined to option 1).

But I'm still a little lost when it comes to the actual implementation of the multi-stage form. My goal is to use a carrier wave to upload files (images) and possibly a geekq workflow for a state machine to help with checks at every step.

To be clear, I'm currently trying to create a record in the database at the initial step of the wizard and update the model every subsequent page.

Any ideas?

It's nice to appreciate an example or a point in the right direction.

Thanks!

Note. I read another post where they mention something about a key / value data store, but unfortunately it's a little over my head ...

+6
source share
1 answer

Key-Value or SQL storage in this regard is very loosely related to your real problem. These are just different approaches to how your data is actually stored in the backend. Using one way or another does not affect your business.

Regarding the actual issue, I find it too general for SO. Multistage forms, as a rule, are very different from each other. There is no β€œone good way” to do this.

The reason you are not getting answers to this is probably because there is no real question. What you have to do is try to do the actual implementation and ask more specific questions when hitting the wall somewhere.

In the end, I believe that multi-stage forms are not really the best idea when it comes to usability. Of course, there are good reasons to use them in some cases, but you should think twice if there is a way to avoid this in your case.

One of the problems I once encountered with forms and downloads was validation (this does not apply to Multi / Single step specifically). Typically, when verification fails, the user will need to re-upload the file. Fortunately, this is not a problem in your case, as Carrierwave handles this automatically.

0
source

Source: https://habr.com/ru/post/890932/


All Articles