Commit a56dcc0a1e494bbfcd49491ae23872cf39523a8c
1 parent
c1fc0260
Exists in
master
and in
28 other branches
Fixing script/sample-products
- Product category is mandatory for products now
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
script/sample-products
@@ -7,6 +7,7 @@ include ActionController::TestProcess | @@ -7,6 +7,7 @@ include ActionController::TestProcess | ||
7 | STDOUT.sync = true | 7 | STDOUT.sync = true |
8 | 8 | ||
9 | enterprises = Enterprise.all | 9 | enterprises = Enterprise.all |
10 | +categories = ProductCategory.all | ||
10 | 11 | ||
11 | print "Creating products: " | 12 | print "Creating products: " |
12 | THINGS = %w[ Car House Bicycle Book Pen Computer Webcam ] | 13 | THINGS = %w[ Car House Bicycle Book Pen Computer Webcam ] |
@@ -15,9 +16,12 @@ for thing in THINGS | @@ -15,9 +16,12 @@ for thing in THINGS | ||
15 | for color in COLORS | 16 | for color in COLORS |
16 | name = [color, thing].join(' ') | 17 | name = [color, thing].join(' ') |
17 | rand(10).times do |i| | 18 | rand(10).times do |i| |
18 | - Product.create(:name => name, :enterprise_id => enterprises.rand.id, :price => (i * 13.7), :image_builder => { | ||
19 | - :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') | ||
20 | - }) | 19 | + Product.create( |
20 | + :name => name, | ||
21 | + :enterprise_id => enterprises.rand.id, :price => (i * 13.7), | ||
22 | + :product_category => categories.rand, | ||
23 | + :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } | ||
24 | + ) | ||
21 | print '.' | 25 | print '.' |
22 | end | 26 | end |
23 | end | 27 | end |