Capturing an Order
Learn to make a user form to capture the order.
We'll cover the following
An order is a set of line items, along with details of the purchase transaction. Our cart already contains line_items
, so all we need to do is add an order_id
column to the line_items
table and create an orders table based on the initial guess at the application data diagram.
First, we create the order model and update the line_items
table:
depot> bin/rails generate scaffold Order name address:text email \
pay_type:integer
depot> bin/rails generate migration add_order_to_line_item order:references
Get hands-on with 1400+ tech skills courses.