2024-02-20 09:07:55 -05:00
|
|
|
class Valuation < ApplicationRecord
|
2024-03-18 11:21:00 -04:00
|
|
|
include Monetizable
|
2024-02-22 11:35:06 -05:00
|
|
|
|
2024-03-18 11:21:00 -04:00
|
|
|
belongs_to :account
|
2024-03-15 12:21:59 -07:00
|
|
|
validates :account, :date, :value, presence: true
|
2024-03-18 11:21:00 -04:00
|
|
|
monetize :value
|
2024-02-22 11:35:06 -05:00
|
|
|
|
2024-03-06 09:56:59 -05:00
|
|
|
scope :in_period, ->(period) { period.date_range.nil? ? all : where(date: period.date_range) }
|
|
|
|
|
2024-03-19 09:10:40 -04:00
|
|
|
def self.to_series
|
|
|
|
TimeSeries.from_collection all, :value_money
|
2024-02-22 11:35:06 -05:00
|
|
|
end
|
2024-02-20 09:07:55 -05:00
|
|
|
end
|