The Order Model
Generate the Order model, which will be used to update the total calculation for orders.
We'll cover the following...
Generate the model
The Order
model is associated with users and products simultaneously.
Thankfully, it is easy to achieve this in Rails. The tricky part is when it comes to serializing this object. We’ll talk more about this later.
We will generate the Order
model using the generate model
command:
$ rails generate model order user:belongs_to total:decimal
We use the references
method to create the ...