1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Account namespace updates: part 4 (transfers, singular namespacing) (#896)

* Move Transfer to Account namespace

* Fix partial resolution due to namespacing plurality

* Make category and tag controllers consistent with namespacing convention

* Update stale partial reference
This commit is contained in:
Zach Gollwitzer 2024-06-20 13:32:44 -04:00 committed by GitHub
parent dc3147c101
commit bddaab0192
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 227 additions and 127 deletions

View file

@ -4,7 +4,7 @@ class Transaction < ApplicationRecord
monetize :amount
belongs_to :account
belongs_to :transfer, optional: true
belongs_to :transfer, optional: true, class_name: "Account::Transfer"
belongs_to :category, optional: true
belongs_to :merchant, optional: true
has_many :taggings, as: :taggable, dependent: :destroy
@ -70,7 +70,7 @@ class Transaction < ApplicationRecord
update_all marked_as_transfer: true
# Attempt to "auto match" and save a transfer if 2 transactions selected
Transfer.new(transactions: all).save if all.count == 2
Account::Transfer.new(transactions: all).save if all.count == 2
end
def daily_totals(transactions, period: Period.last_30_days, currency: Current.family.currency)