create_products

in lib/tasks/db/prime.rake [22:48]


  def create_products
    [
      ['OP-DRC-C1', 'Brazil Verde, Italian Roast', 'Soft, nutty, low acid, with nice bitter-sweet chocolate tastes.', 3, '80', 1500, 3200],
      ['OP-MRC-C2', 'Jamaica Blue Mountain, Vienna Roast', 'Rich flavor, rich aroma, moderate acidity, and an even balance.', 2, '0', 20000, 42000],
      ['OP-LRC-C3', 'Colombian Supremo, Cinnamon Roast', 'Full bodied with a light acidity making a balanced cup.', 1, '150', 2000, 4200],
      ['OP-LRC-C4', 'Guatemala Antigua, New England Roast', 'Lively acidity, complex spiciness, and chocolate laced aftertaste.', 1, '0', 1300, 2900],
      ['OP-MRC-C5', 'Ethiopian Moka Java, Breakfast Roast', 'Possess an intense floral bouquet and create a pleasant cup of coffee.', 2, '130', 1800, 3900],
      ['OP-DRC-C6', 'European Royale, French Roast', 'Begins full, mellows as it lingers and then finishes with a smooth sweet aftertaste.', 3, '70', 1200, 2500],
      ['OP-MRC-C7', 'Hawaiian Kona, Medium Roast', 'A rich, rounded cup with superb fragrance and flavor of Kona.', 2, '60', 2100, 3200],
      ['OP-LRC-C8', 'Papua New Guinea Arokara, Light City Roast', 'Sweet aroma, round body, lively acidity.', 1, '90', 1400, 2900],
      ['OP-DRC-C9', 'Bali Blue Moon, French Roast', 'A classic clean cup with great body and mildness.', 3, '70', 1200, 2200]
    ].each do |data|
      sku, name, description, type_id, stock, cost, selling_price = data
      Product.create!(
        sku: sku,
        name: name,
        description: description,
        product_kind: ProductKind.find(type_id),
        stock: stock,
        cost: cost,
        selling_price: selling_price
      )
      yield if block_given?
    end
    puts '' if block_given?
  end