app/models/iro/stock.rb in iron_warbler-2.0.7.8 vs app/models/iro/stock.rb in iron_warbler-2.0.7.9

- old
+ new

@@ -1,19 +1,29 @@ - class Iro::Stock include Mongoid::Document include Mongoid::Timestamps store_in collection: 'iro_stocks' STATUS_ACTIVE = 'active' STATUS_INACTIVE = 'inactive' - STATUSES = [ 'active', 'inactive' ] + STATUSES = [ nil, 'active', 'inactive' ] def self.active where( status: STATUS_ACTIVE ) end + field :status field :ticker validates :ticker, uniqueness: true, presence: true + field :last, type: :float + + def self.list + end + + def self.tickers_list + [nil] + all.map( &:ticker ) + end + + # has_many :strategies, class_name: 'Iro::Strategy', inverse_of: :stock end