ruby on rails - Create a wizard that works with multiple Resources -


I'm writing an app that has the "Wizard" type input section, think of MS Windows Installer.

I find it difficult to find out how fast the best way to do this with rail. I can do it in a non-pure way (already done for version 1), But I am trying to be a bit idiotic at this time.

Here's the situation I have a 5 step wizard that has to collect information. Deal with steps 1, 2, and 4 resources. Phase 3 deals with multiples of Resource B and they have to be associated with Resource A. Step 5 is only a confirmation.

So I have my resource controller and my resource B_controller ... but they save / update only one resource I'm guessing that I have a wizard for each step in the process- the controller Should be installed, but I'm not sure how routing should work.

For example ...

  Wizard Controller & lt; ApplicationController def stepOne @resourceA = ResourceA.new end def stepTwo @resourceA = params [: id] end ... def stepFive end end  

and then see my view at StepOne:

  & lt; Form action = '/ resource a / new' / & gt;  

and on StepTwo verb

  & lt; Form action = '/ resourceA / 12345 / edit' / & gt;  

etc.

But then my resource A and Resource B controllers should know how to redirect the appropriate steps in the Wizard / Controller. Tangled dirt!

Am I anywhere near the right path? Or is there a plug-in mechanism or plugin for such things.

It is important to provide a minimum set of tasks for a RESTful service, using a client Understand the difference between (It provides the right data knows).

  • For example, you should be able to post / resourceA / 12345 to edit that existing resource
< / Li>
  • A guaranteed service does not guarantee any guarantee about other URLs will return meaningful response.

    • A notable example is that REST will not specify that / resource A / 12345 / edit is designed to edit that resource An HTML form will return This is a feature of the HTML application, which provides a method to display the positions described above.

    • To expand this principle, it is perfectly acceptable that there are many editing modes which define all the POST URLs as defined by the edit Action Generally, whatever is used with the .attributes = ... , you can see the attributes that are crossed, which is the information that HTML buttons use with the form submission To do this, to decide which page to use the user's Should look forward.

    • It can rely on a control method to deal with submissions of multiple pages, but with clever verification and select overwriting accessories, how do you use the users' app? Can keep a lot of control over it.

    • You should also be able to understand that this method is not restricted to users only in the order presented in the form to restrict the attributes of a tired customer a resource The principle post may be updated for the all attributes associated with, instead of one page presented by your wizard. Believing the methods of your model, it is necessary that everything can be done just to work.


  • Comments

    Popular posts from this blog

    MySql variables and php -

    url rewriting - How to implement the returnurl like SO in PHP? -

    Which Python client library should I use for CouchdB? -