drdispatch/cadence — Issue #3: Invoice/Product Model
Author: drdispatch
Created: 2012-02-21 00:05:23+00:00
State: open

### Invoice model

Customers can be invoiced a bunch of timer.

````ruby
class Invoice < AR::Base
has_one :customer
end

class Customer
has_many :invoices
end

### Product

An item purchased from invoice, an invoice line item is derived from a product.

May affect the customer/invoice relationships as this may be habtm through relationship introducing perhaps 'transactions' or 'purchases'.

Customer can purchase products from us via Invoices. Invoice has one customer and one or more products.

@customer = Customer.first
@customer.products <= All purchased products
@customer.invoices <= pulls all invoices for a customer.

@products = Product.all <= all products, probably 5-6 total

@product.customers <= all customers that have the product through an invoice
@product.invoices <= all invoices showing this product

so perhaps it's that a product has customers through invoice and invoice has customers and products and a customer has products through invoice?