Sha256: db641b04e2f2fcf08b287e31a10d63dd6dcaad4b1f3f21326c7978a68f7cf845
Contents?: true
Size: 610 Bytes
Versions: 9
Compression:
Stored size: 610 Bytes
Contents
namespace :erp_inventory do desc 'Clear all inventory' task :clear => :environment do InventoryEntry.destroy_all end desc 'Initial load for inventory' task :initial_load => :environment do product_types = ProductType.all product_types.each do |product_type| count = ProductInstance.count(:conditions => ['product_type_id = ?', product_type.id]) puts "Creating inventory for #{product_type.description}" InventoryEntry.create(:description => "Inventory for #{product_type.description}", :product_type_id => product_type.id, :number_available => count) end end end
Version data entries
9 entries across 9 versions & 1 rubygems