Track expenses
This commit is contained in:
parent
7521ebaa45
commit
e588ab3db0
19 changed files with 374 additions and 0 deletions
13
app/models/expense.rb
Normal file
13
app/models/expense.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue