1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 23:59:40 +02:00

Add validation to security price model

This commit is contained in:
Zach Gollwitzer 2024-10-30 09:51:05 -04:00
parent cd91e66618
commit c9917674aa
3 changed files with 5 additions and 3 deletions

View file

@ -3,6 +3,8 @@ class Security::Price < ApplicationRecord
belongs_to :security
validates :price, :currency, presence: true
class << self
def find_price(security:, date:, cache: true)
result = find_by(security:, date:)