mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +02:00
14 lines
278 B
Ruby
14 lines
278 B
Ruby
class Valuation < ApplicationRecord
|
|
belongs_to :account
|
|
|
|
after_commit :sync_account
|
|
|
|
def trend(previous)
|
|
Trend.new(current: value, previous: previous&.value, type: account.classification)
|
|
end
|
|
|
|
private
|
|
def sync_account
|
|
self.account.sync_later
|
|
end
|
|
end
|