mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-04 21:15:19 +02:00
Multi-currency support: Money + Currency class improvements (#553)
* Money improvements * Replace all old money usage
This commit is contained in:
parent
e5750d1a13
commit
fe2fa0eac1
43 changed files with 2982 additions and 196 deletions
|
@ -1,4 +1,6 @@
|
|||
class Transaction < ApplicationRecord
|
||||
include Monetizable
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :category, optional: true
|
||||
|
||||
|
@ -6,6 +8,12 @@ class Transaction < ApplicationRecord
|
|||
|
||||
after_commit :sync_account
|
||||
|
||||
monetize :amount
|
||||
|
||||
scope :inflows, -> { where("amount > 0") }
|
||||
scope :outflows, -> { where("amount < 0") }
|
||||
scope :active, -> { where(excluded: false) }
|
||||
|
||||
def self.ransackable_attributes(auth_object = nil)
|
||||
%w[name amount date]
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue