Skip to content

Instantly share code, notes, and snippets.

@gmacdougall
Created March 5, 2015 14:46
Show Gist options
  • Save gmacdougall/dbbe2cd68ff9d587c131 to your computer and use it in GitHub Desktop.
Save gmacdougall/dbbe2cd68ff9d587c131 to your computer and use it in GitHub Desktop.
Giant Spree Dataset
shipping_category = Spree::ShippingCategory.create! name: 'default'
20.times { |i| Spree::StockLocation.create! name: i.to_s }
ActiveRecord::Base.no_touching do
10_000.times do
product = Spree::Product.create! name: SecureRandom.hex, price: 20, shipping_category: shipping_category
rand(1..10).times do
variant = Spree::Variant.create! product: product
variant.stock_items.shuffle.first(rand(1..20)).each { |stock_item| stock_item.update_columns(count_on_hand: rand(1..1000)) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment