Skip to content

Instantly share code, notes, and snippets.

@edugonch
Created February 22, 2011 16:47
Show Gist options
  • Save edugonch/838958 to your computer and use it in GitHub Desktop.
Save edugonch/838958 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
["Blender","Cake Pan","China Cap","Coctail Shaker","Colander","Food Processor","French Knife","Grater","Half Hotel Pan","Half Sheet Pan","Hotel Pan","Ladle","Large Brazier","Large Sauté Pan","Measuring Cups","Measuring Spoons","Meat Mallet","Metal Spatula","Mixer","Mixing Bowl","P.C. Scale","Paring Knife","Pastry Brush","Pastry Cutter","Pie/Tarte Pan","Roasting Pan","Rolling Pin","Rubber Spatula","Sauce Pan","Serrated Knife","Sheet Pan","Sieve","Small Brazier","Small Sauté Pan","Stock Pot","Strainer","Tongs","Wire Whip"].each do |tool|
Tool.create(:name => tool)
end
["g","kg","mg","lb","oz","pt","qt","gal","tsp","tbl","ml","fl oz"].each do |unit|
Unit.create(:name => unit)
end
["Peanuts","Wheat"].each do |allergen|
Allergen.create(:name => allergen)
end
["Bread","Cheese","Dairy","Dry Good", "Fish", "Meat", "Poultry", "Produce"].each do |category|
ItemCategory.create(:name => category)
end
[{:from_unit => 'g',:to_unit => 'mg',:to_quantity => '1000'},
{:from_unit => 'mg',:to_unit => 'g',:to_quantity => '0.001'},
{:from_unit => 'oz',:to_unit => 'lb',:to_quantity => '0.0625'},
{:from_unit => 'lb',:to_unit => 'oz',:to_quantity => '16'},
{:from_unit => 'tsp',:to_unit => 'ml',:to_quantity => '4.92892159'},
{:from_unit => 'ml',:to_unit => 'fl oz',:to_quantity => '0.0338140227'},
{:from_unit => 'kg',:to_unit => 'g',:to_quantity => '1000'},
{:from_unit => 'kg',:to_unit => 'mg',:to_quantity => '1000000'},
{:from_unit => 'oz',:to_unit => 'g',:to_quantity => '28.3495231'}].each do |conversion|
from_unit = Unit.find_by_name (conversion [:from_unit])
to_unit = Unit.find_by_name (conversion [:to_unit])
Conversion.create(:from_unit_id => from_unit.id, :to_unit_id => to_unit.id, :to_quantity => conversion [:to_quantity])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment