Sha256: d261bb9f2744beeb2e4f0b3b8c4ce12e875ea6d464707362596c0e2b01ab0a5a

Contents?: true

Size: 713 Bytes

Versions: 12

Compression:

Stored size: 713 Bytes

Contents

class ShopPackagesDataset < Dataset::Base
  
  uses :shop_products

  def load
    packages = {
      :bread  => [ :soft, :crusty, :warm ]
    }
    
    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}_bread".to_s.to_sym,
          :quantity => 1,
          :position => 1,
          :package  => shop_packages("all_#{package.to_s}".to_sym),
          :product  => shop_products("#{product.to_s}_bread".to_sym)
      end
    end
  end
  
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
radiant-shop_packages-extension-0.0.6 app/datasets/shop_packages.rb
radiant-shop_packages-extension-0.0.5 app/datasets/shop_packages.rb
radiant-shop_packages-extension-0.0.4 app/datasets/shop_packages.rb
radiant-shop_packages-extension-0.0.3 app/datasets/shop_packages.rb
radiant-shop_packages-extension-0.0.2 app/datasets/shop_packages.rb
radiant-shop_packages-extension-0.0.1 app/datasets/shop_packages.rb
radiant-shop-extension-0.11.6 spec/datasets/shop_packages.rb
radiant-shop-extension-0.11.5 spec/datasets/shop_packages.rb
radiant-shop-extension-0.11.4 spec/datasets/shop_packages.rb
radiant-shop-extension-0.11.3 spec/datasets/shop_packages.rb
radiant-shop-extension-0.11.1 spec/datasets/shop_packages.rb
radiant-shop-extension-0.11.0 spec/datasets/shop_packages.rb