Method: Opensteam::ProductBase#add_properties

Defined in:
lib/opensteam/product_base.rb

#add_properties(prop) ⇒ Object

Add properties to the current product. For every property (or set of properties) an inventory-object is created (unless an inventory-object for the property (or set of properties) already exists).



234
235
236
237
238
239
240
241
242
243
# File 'lib/opensteam/product_base.rb', line 234

def add_properties(prop)
  prop.each do |pp|
    unless self.inventories.exist_by_properties?( pp.is_a?( Array ) ? pp : [pp] )
      i = Opensteam::InventoryBase::Inventory.create( :price => 0, :storage => 0, :active => 0 )
      i.properties << pp
      inventories << i
    end
  end
  
end