Capturing the Order Details
Learn to get user details for order confirmation.
Feel free to make other changes, but only the first is currently used in the functional tests. For these tests to pass, we’ll need to implement the model.
Let’s implement the create()
action in line 1 in the orders_controller.rb
. This method has to do the following:
-
Capture the values from the form to populate a new
Order
model object. -
Add the line items from our cart to that order.
-
Validate and save the order. If this fails, display the appropriate messages and let the user correct any problems.
-
Once the order is successfully saved, delete the cart, redisplay the catalog page, and display a message confirming that the order has been placed.
Get hands-on with 1400+ tech skills courses.