Sha256: 74f2a4cb601f1f09f3b77f61d45ef392383d6f1df9e7d4b53f6f51fb909ffb8b
Contents?: true
Size: 425 Bytes
Versions: 1
Compression:
Stored size: 425 Bytes
Contents
class Variant < ActiveRecord::Base belongs_to :product has_many :inventory_units has_and_belongs_to_many :option_values validates_presence_of :product # gives the inventory count for variants with the specified inventory status def inventory(status) InventoryUnit.count(:conditions => "status = #{status} AND variant_id = #{self.id}", :joins => "LEFT JOIN variants on variants.id = variant_id") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree-0.0.9 | app/models/variant.rb |