mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 20:14:08 +00:00
Multi-currency support: Money + Currency class improvements (#553)
* Money improvements * Replace all old money usage
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user