Sha256: 0c394dfcc4f218bf4f63d9ec6231828268d806c84895787e48acfeb9a40786fe

Contents?: true

Size: 678 Bytes

Versions: 5

Compression:

Stored size: 678 Bytes

Contents

class InventoryEntry < ActiveRecord::Base

	belongs_to :inventory_entry_record, :polymorphic => true
	belongs_to :product_type
	has_one  :classification, :as => :classification, :class_name => 'CategoryClassification'
	has_many :prod_instance_inv_entries
	has_many :product_instances, :through => :prod_instance_inv_entries do
    def available
      includes([:prod_availability_status_type]).where('prod_availability_status_types.internal_identifier = ?', 'available')
    end

    def sold
      includes([:prod_availability_status_type]).where('prod_availability_status_types.internal_identifier = ?', 'sold')
    end
  end
	 
  def to_label
    "#{description}"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
erp_inventory-3.0.5 app/models/inventory_entry.rb
erp_inventory-3.0.4 app/models/inventory_entry.rb
erp_inventory-3.0.3 app/models/inventory_entry.rb
erp_inventory-3.0.1 app/models/inventory_entry.rb
erp_inventory-3.0.0 app/models/inventory_entry.rb