Sha256: 3f074ac5dbd3dff1bdd400ee749850aaba246e53d4efe7ee8f3d9a20fc691a86

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

class ShopPackagesDataset < Dataset::Base
 uses :shop_products
 
 def load
   packages = {
     :bread  => [ :soft, :crusty, :warm ],
     :milk   => [ :full, :hilo, :choc ]
   }
   packages.each do |package, products|
     create_record :shop_package, "all_#{package.to_s}".to_sym,
       :name     => "all #{package.to_s}",
       :sku      => "all_#{package.to_s}",
       :price    => 1 * 10
       
     products.each_with_index do |product, i|
       create_record :shop_packing, "#{product.to_s}_#{package.to_s}".to_s.to_sym,
         :quantity => 1,
         :position => 1,
         :package  => shop_packages("all_#{package.to_s}".to_sym),
         :product  => shop_products("#{product.to_s}_#{package.to_s}".to_sym)
     end
   end	
 end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-shop_packages-extension-0.0.6 spec/datasets/shop_packages.rb
radiant-shop_packages-extension-0.0.5 spec/datasets/shop_packages.rb
radiant-shop_packages-extension-0.0.4 spec/datasets/shop_packages.rb