Skip to content

Instantly share code, notes, and snippets.

@mjfreshyfresh
Created February 4, 2009 00:20
Show Gist options
  • Save mjfreshyfresh/57846 to your computer and use it in GitHub Desktop.
Save mjfreshyfresh/57846 to your computer and use it in GitHub Desktop.
namespace :data do
desc "load in some basic data [caution: will nuke and replcace categories, categorizations and inventory items]"
task :bootstrap => :environment do
# clean out existing:
[Category, Categorization, InventoryItem].each{|m| m.find(:all).each{|i| i.destroy}}
InventoryItem.create! :name => "Compass"
c = Category.create! :name => "Basic Apparel"
["Men’s Heavyweight Cotton T",
"Men’s Heavyweight Polo",
"Women’s Organic Cotton Fitted T",
"Women’s Fitted Polo",
"Children’s T-Shirt",
"Jr’s Distressed Hoodie",
"Hemp Messenger Bag"].each do |name|
c.inventory_items.create! :name => name
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment