Files
project-work/worker-toolkit-stocks-in-the-future/repo/app/models/portfolio_snapshot.rb
Eric Bell 2854619bc9 chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
2026-08-11 14:44:09 -04:00

14 lines
333 B
Ruby

# frozen_string_literal: true
class PortfolioSnapshot < ApplicationRecord
belongs_to :portfolio
validates :date, presence: true
validates :worth_cents, presence: true, numericality: { greater_than_or_equal_to: 0 }
validates :portfolio_id, uniqueness: { scope: :date }
def current_worth
worth_cents / 100.0
end
end