Note that there are some explanatory texts on larger screens.

plurals
  1. POOrder confirmation page in rails
    text
    copied!<p>I've been trying to create an order confirmation page for my rails app, and am not quite sure how to go about it in a restful way.</p> <p>There were a few answers on <a href="https://stackoverflow.com/questions/445293/ruby-on-rails-confirmation-page-for-activerecord-object-creation">this</a> question that got me halfway there, but the problem was that I wasn't quite sure how to set up the form in the rails view so that it would take the user to a confirmation page with all their details instead of a create action.</p> <p>Right now my view is simple: </p> <pre><code> &lt;% form_for :order do |f| %&gt; &lt;%= f.error_messages %&gt; &lt;p&gt; &lt;%= f.label :first_name %&gt;&lt;br /&gt; &lt;%= f.text_field :first_name, :size =&gt; 15 %&gt; &lt;/p&gt; &lt;p&gt; &lt;%= f.label :last_name %&gt;&lt;br /&gt; &lt;%= f.text_field :last_name, :size =&gt; 15 %&gt; &lt;/p&gt; (Be sure to enter your name as it appears on your card) &lt;p&gt; &lt;%= f.label :card_type %&gt;&lt;br /&gt; &lt;%= f.select :card_type, [["Visa", "visa"], ["MasterCard", "master"], ["Discover", "discover"], ["American Express", "american_express"]] %&gt; &lt;/p&gt; &lt;p&gt; &lt;%= f.label :card_number %&gt;&lt;br /&gt; &lt;%= f.text_field :card_number %&gt; &lt;/p&gt; &lt;p&gt; &lt;%= f.label :card_verification, "Card Verification Value (CVV)" %&gt;&lt;br /&gt; &lt;%= f.text_field :card_verification, :size =&gt; 3 %&gt; &lt;/p&gt; &lt;p&gt; &lt;%= f.label :card_expires_on %&gt;&lt;br /&gt; &lt;%= f.date_select :card_expires_on, :discard_day =&gt; true, :start_year =&gt; Date.today.year, :end_year =&gt; (Date.today.year+10), :add_month_numbers =&gt; true %&gt; &lt;/p&gt; &lt;p&gt;&lt;%= f.submit "Submit" %&gt;&lt;/p&gt; </code></pre> <p>What things should I be doing to direct the user to a confirmation page that shows all the order details?</p> <p>Thanks!</p> <p>Kenji</p>
 

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