Module: Asset::Stock::CanCreateStockAsset

Included in:
LibraryTube, MultiplexedLibraryTube
Defined in:
app/models/asset/stock.rb

Overview

Extending this module will allow an asset to have a stock asset and be able to create it.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object


6
7
8
9
10
11
12
13
# File 'app/models/asset/stock.rb', line 6

def self.extended(base)
  base.class_eval do
    stock_asset_type_name = stock_asset_type.name
    has_one_as_child(:stock_asset, -> { where(sti_type: stock_asset_type_name) })

    delegate :is_a_stock_asset?, to: 'self.class'
  end
end

Instance Method Details

#is_a_stock_asset?Boolean

By being able to create a stock asset the asset itself is not a stock.

Returns:

  • (Boolean)

16
17
18
# File 'app/models/asset/stock.rb', line 16

def is_a_stock_asset?
  false
end