Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3 / Form without Model: How do I create a form that is not tied to a model?
    primarykey
    data
    text
    <p>I have a model, and I have a view that displays a form for creating a new object based on that model. Let's call that form, <code>Form1</code>.</p> <p>Once the user submits <code>Form1</code>, the object is created. I then want to display, on the following page, a second form <code>Form2</code>, which asks the user to check off various options before the object is saved to the database.</p> <p>My problem is probably extremely basic. I don't know how to create <code>Form2</code>, given that it is not tied directly to the model. Because I am a <code>Rails</code> newbie, I have only created forms as following:</p> <pre><code>form_for(@object) { |f| ... } </code></pre> <p><em><code>@object</code> is an object instantiated from the model</em></p> <p><strong>Problem</strong>: I do not believe that kind of code will work for my purposes here. How do I create <code>Form2</code>, given that it must not be based on <code>@object</code> or <code>@object</code>'s model?</p> <p><strong>Some specifics from my app</strong>: </p> <p>The site accepts values (<code>Form1</code>) before redirecting to an <code>OAuth</code> server. </p> <p>When the user verifies her credentials on the <code>OAuth</code> server, she is redirected back to my site. An <code>XML-RPC</code> request then retrieves information about the user's account on the <code>OAuth</code> server. </p> <p>The <code>XML</code> response may indicate that the user has only one account on the <code>OAuth</code> server. If so, some values are retrieved from the <code>XML</code> and added to the object--which is then (finally) saved in the database--and the user is redirected to a success page. </p> <p>However, if the <code>XML</code> response indicates that the user has multiple accounts on the <code>OAuth</code> server, I want to display a form (<code>Form2</code>) that allows the user to select which accounts on the OAuth server to associate with my site. So <code>Form2</code> really asks the user <em>how many</em> objects to create, rather than about specific attributes of an object.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload