mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Handle case sensitive values when creating securities
This commit is contained in:
parent
867318cbc1
commit
d8e058d7c6
4 changed files with 49 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
class Security < ApplicationRecord
|
||||
include Provided
|
||||
|
||||
before_save :upcase_ticker
|
||||
before_validation :upcase_symbols
|
||||
|
||||
has_many :trades, dependent: :nullify, class_name: "Trade"
|
||||
has_many :prices, dependent: :destroy
|
||||
|
@ -29,8 +29,8 @@ class Security < ApplicationRecord
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def upcase_ticker
|
||||
def upcase_symbols
|
||||
self.ticker = ticker.upcase
|
||||
self.exchange_operating_mic = exchange_operating_mic.upcase if exchange_operating_mic.present?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue