Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
h1. Tab Keep track of office tabs. h2. Models Users: id, name Orders: id, LineItems LineItems: id, order_id, name, cost, quantity Transactions (Debits, Credits): id, type, line_item_id, user_id, amount, balance h2. Scenarios * Bob orders a pizza. Bob, Joe, and Clint split the cost. o = Order.create li = LineItem.create( :order => o, :name => "Lg Antico Pizza", :cost => 20_00, :quantity => 1 ) # Bob has paid $20 into the system, giving him credit Credit.create(:line_item => li, :user => bob, :amount => 20_00) # Each person owes $20 / 3, including Bob (he did eat, right?) individual_cost = li.cost / users.size # $20.00 / 3 users.each do |u| Debit.create( :line_item => li, :user => u, :amount => individual_cost) end