Track expenses

This commit is contained in:
Andrew Tomaka 2022-11-20 15:43:33 -05:00
parent 7521ebaa45
commit e588ab3db0
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
19 changed files with 374 additions and 0 deletions

13
app/models/expense.rb Normal file
View file

@ -0,0 +1,13 @@
class Expense < ApplicationRecord
PERIOD_OCCURENCES = {
monthly: 12,
annually: 1,
weekly: 52,
quarterly: 3,
}.freeze
enum :period, PERIOD_OCCURENCES.keys
def monthly
payment * PERIOD_OCCURENCES[period.to_sym] / 12
end
end