From a56dcc0a1e494bbfcd49491ae23872cf39523a8c Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Mon, 19 Jul 2010 21:40:01 -0300 Subject: [PATCH] Fixing script/sample-products --- script/sample-products | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/sample-products b/script/sample-products index 3c9130f..136e953 100755 --- a/script/sample-products +++ b/script/sample-products @@ -7,6 +7,7 @@ include ActionController::TestProcess STDOUT.sync = true enterprises = Enterprise.all +categories = ProductCategory.all print "Creating products: " THINGS = %w[ Car House Bicycle Book Pen Computer Webcam ] @@ -15,9 +16,12 @@ for thing in THINGS for color in COLORS name = [color, thing].join(' ') rand(10).times do |i| - Product.create(:name => name, :enterprise_id => enterprises.rand.id, :price => (i * 13.7), :image_builder => { - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') - }) + Product.create( + :name => name, + :enterprise_id => enterprises.rand.id, :price => (i * 13.7), + :product_category => categories.rand, + :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } + ) print '.' end end -- libgit2 0.21.2