diff --git a/app/controllers/debts_controller.rb b/app/controllers/debts_controller.rb new file mode 100644 index 0000000..97ad838 --- /dev/null +++ b/app/controllers/debts_controller.rb @@ -0,0 +1,7 @@ +class DebtsController < ApplicationController + def index + @debts = current_user.debts + end + + def update; end +end diff --git a/app/models/debt.rb b/app/models/debt.rb index 951347c..629bc51 100644 --- a/app/models/debt.rb +++ b/app/models/debt.rb @@ -2,4 +2,12 @@ class Debt < ApplicationRecord belongs_to :debtor, class_name: 'User' belongs_to :creditor, class_name: 'User' belongs_to :bet, optional: true + + def won_option + bet.options.winners.first + end + + def user_option(user) + user.user_bets.find_by(bet: bet).bet_option + end end diff --git a/app/views/debts/_my_debt.html.erb b/app/views/debts/_my_debt.html.erb new file mode 100644 index 0000000..3c8cdcd --- /dev/null +++ b/app/views/debts/_my_debt.html.erb @@ -0,0 +1,6 @@ +
I owe | +this much | +because | +and I bet on | +
---|