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:)