Sha256: 48b0cda2c06b10e91260aff717ebe5dd406c4fcaa5621c290f8dcb9d63fc1f06

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

class InventoryEntry < ActiveRecord::Base
  attr_protected :created_at, :updated_at

	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

1 entries across 1 versions & 1 rubygems

Version Path
erp_inventory-3.1.0 app/models/inventory_entry.rb