Most implementations of shopping carts I have seen is that a user
stores line items in a cart, where the line items represent products
or subscriptions. So a cart has many products through line items and a
product can have many carts through line items. Then a customer makes
an order and so you introduce a new model order. The order has
information such as customer’s name, the payment type, and if you are
working with a payment gateway, such as paypal, it will contain paypal
tokens and recurring tokens. So the order and the cart are two
different models, two different purposes. Cart is a thing that enables
a customer to store things in, and a order is the thing that handles
payments. So I was watching this railscasts and he updates a
purchased_at attribute on the cart itself:
But is a cart really purchased, or is it the order that is purchased?
If the order contains all payment information, shouldn’t the order
contain the purchased_at attribute and not the cart?