End chapter 10
[depot.git] / app / models / line_item.rb
1 class LineItem < ActiveRecord::Base
2 belongs_to :order
3 belongs_to :product
4
5 def self.from_cart_item(cart_item)
6 li = self.new
7 li.product = cart_item.product
8 li.quantity = cart_item.quantity
9 li.total_price = cart_item.price
10 li
11 end
12 end