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.
There were a few answers on this 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.
What things should I be doing to direct the user to a confirmation page that shows all the order details?
You need a new action in your controller that will handle the
confirmation and then update your current form to
confirmation action instead of the
create action. Then on your
confirmation page, you'll replicate the form again, and this time have it
POST to the
create action once the user approves the transaction. Don't forget to add the route to handle the
There's probably room for debate as to which request method to use for the
confirmation action. I personally say
GET just because we're not modifying any records or saving anything yet, but I'm hardly an authority on the matter :)
Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.